Todo: Implement packet rewriting in Moose Net Device.
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
+ * Author: Richard Whitehouse <ns3@richardwhiuk.com>
* Author: Gustavo Carneiro <gjc@inescporto.pt>
*/
#include "bridge-net-device.h"
NS_LOG_FUNCTION_NOARGS ();
NS_ASSERT (device != this);
-// This is probably wrong and needs fixing.
+
+ NS_LOG_DEBUG("AddBridgePort(bridge_addr=" << m_address << ", device_address=" << (Mac48Address::ConvertFrom(device->GetAddress())));
+
if (m_address == Mac48Address ())
{
m_address = Mac48Address::ConvertFrom (device->GetAddress ());
}
- Ptr<BridgePortNetDevice> port = CreateObject<BridgePortNetDevice>(this, device, m_node);
+ Ptr<BridgePortNetDevice> port = CreateBridgePort(this, device, m_node);
m_ports.push_back(port);
m_channel->AddChannel (device->GetChannel ());
}
+Ptr<BridgePortNetDevice>
+BridgeNetDevice::CreateBridgePort(Ptr<BridgeNetDevice> bridge, Ptr<NetDevice> device, Ptr<Node> node){
+ return CreateObject<BridgePortNetDevice>(bridge, device, node);
+}
+
void
BridgeNetDevice::SetIfIndex(const uint32_t index)
{
#include "ns3/mac48-address.h"
#include "ns3/nstime.h"
#include "ns3/bridge-channel.h"
+#include "ns3/object-factory.h"
#include <stdint.h>
#include <string>
#include <map>
protected:
virtual void DoDispose (void);
- void Forward (Ptr<BridgePortNetDevice> port, Ptr<const Packet> packet, uint16_t protocol, Address const &src, Address const &dst, PacketType packetType);
- void ForwardUnicast (Ptr<BridgePortNetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol, Mac48Address src, Mac48Address dst);
- void ForwardBroadcast (Ptr<BridgePortNetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol, Mac48Address src, Mac48Address dst);
- void Learn (Address const &src, Ptr<BridgePortNetDevice> port);
- Ptr<BridgePortNetDevice> GetLearnedState (Mac48Address source);
+ virtual void Forward (Ptr<BridgePortNetDevice> port, Ptr<const Packet> packet, uint16_t protocol, Address const &src, Address const &dst, PacketType packetType);
+ virtual void ForwardUnicast (Ptr<BridgePortNetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol, Mac48Address src, Mac48Address dst);
+ virtual void ForwardBroadcast (Ptr<BridgePortNetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol, Mac48Address src, Mac48Address dst);
+ virtual void Learn (Address const &src, Ptr<BridgePortNetDevice> port);
+ virtual Ptr<BridgePortNetDevice> GetLearnedState (Mac48Address source);
+
+ virtual Ptr<BridgePortNetDevice> CreateBridgePort(Ptr<BridgeNetDevice> bridge, Ptr<NetDevice> device, Ptr<Node> node);
private:
NetDevice::ReceiveCallback m_rxCallback;
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Author: Gustavo Carneiro <gjc@inescporto.pt>
* Author: Richard Whitehouse <ns3@richardwhiuk.com>
*/
#ifndef BRIDGE_PORT_NET_DEVICE_H
--- /dev/null
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * 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: Richard Whitehouse <ns3@richardwhiuk.com>
+ * Author: Gustavo Carneiro <gjc@inescporto.pt>
+ */
+
+#include "moose-bridge-net-device.h"
+#include "moose-bridge-port-net-device.h"
+#include "ns3/log.h"
+#include "ns3/node.h"
+
+NS_LOG_COMPONENT_DEFINE ("MooseBridgeNetDevice");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (MooseBridgeNetDevice);
+
+TypeId
+MooseBridgeNetDevice::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::MooseBridgeNetDevice")
+ .SetParent<BridgeNetDevice> ()
+ .AddConstructor<MooseBridgeNetDevice> ();
+ return tid;
+}
+
+MooseBridgeNetDevice::MooseBridgeNetDevice() : BridgeNetDevice() {
+ NS_LOG_FUNCTION_NOARGS ();
+
+ m_mooseAddress = MooseAddress::Allocate();
+
+}
+
+MooseBridgeNetDevice::~MooseBridgeNetDevice(){
+ NS_LOG_FUNCTION_NOARGS ();
+}
+
+Ptr<BridgePortNetDevice> MooseBridgeNetDevice::CreateBridgePort(Ptr<BridgeNetDevice> bridge, Ptr<NetDevice> device, Ptr<Node> node){
+ return CreateObject<MooseBridgePortNetDevice>(bridge, device, node);
+}
+
+/*
+//bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
+//bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
+
+void Forward (Ptr<BridgePortNetDevice> port, Ptr<const Packet> packet, uint16_t protocol, Address const &src, Address const &dst, PacketType packetType){
+
+}
+
+void ForwardUnicast (Ptr<BridgePortNetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol, Mac48Address src, Mac48Address dst);
+void ForwardBroadcast (Ptr<BridgePortNetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol, Mac48Address src, Mac48Address dst);
+void Learn (Address const &src, Ptr<BridgePortNetDevice> port);
+Ptr<BridgePortNetDevice> GetLearnedState (Mac48Address source);*/
+
+
+}
+
--- /dev/null
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * 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: Richard Whitehouse <ns3@richardwhiuk.com>
+ */
+#ifndef MOOSE_BRIDGE_NET_DEVICE_H
+#define MOOSE_BRIDGE_NET_DEVICE_H
+
+#include "bridge-net-device.h"
+#include "ns3/moose-address.h"
+#include "ns3/moose-prefix-address.h"
+#include "ns3/moose-suffix-address.h"
+
+namespace ns3 {
+
+/**
+ * \ingroup bridge
+ * \brief a virtual net device that bridges multiple LAN segments
+ *
+ * MOOSE (Multi-Level Origin Organised Scalable Ethernet) Implementation
+ */
+class MooseBridgeNetDevice : public BridgeNetDevice
+{
+
+public:
+ static TypeId GetTypeId (void);
+ MooseBridgeNetDevice ();
+ virtual ~MooseBridgeNetDevice ();
+
+protected:
+
+// From NetDevice
+
+// Unconvinced we need these...
+
+// virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
+// virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
+
+// From BridgeNetDevice
+
+/*
+
+ virtual void Forward (Ptr<BridgePortNetDevice> port, Ptr<const Packet> packet, uint16_t protocol, Address const &src, Address const &dst, PacketType packetType);
+ virtual void ForwardUnicast (Ptr<BridgePortNetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol, Mac48Address src, Mac48Address dst);
+ virtual void ForwardBroadcast (Ptr<BridgePortNetDevice> incomingPort, Ptr<const Packet> packet, uint16_t protocol, Mac48Address src, Mac48Address dst);
+ virtual void Learn (Address const &src, Ptr<BridgePortNetDevice> port);
+ virtual Ptr<BridgePortNetDevice> GetLearnedState (Mac48Address source); */
+
+ virtual Ptr<BridgePortNetDevice> CreateBridgePort(Ptr<BridgeNetDevice> bridge, Ptr<NetDevice> device, Ptr<Node> node);
+
+private:
+
+// Need more types of state
+
+/**
+ Local Port Mappings
+ -- Implemented in parent.
+
+ struct LearnedState
+ {
+ Ptr<BridgePortNetDevice> associatedPort;
+ Time expirationTime;
+ };
+ std::map<Mac48Address, LearnedState> m_learnState;
+**/
+
+ MooseAddress m_mooseAddress;
+
+ // Remote Moose State
+
+ struct PrefixState
+ {
+ Ptr<BridgePortNetDevice> associatedPort;
+ Time expirationTime;
+ };
+ std::map<MoosePrefixAddress, PrefixState> m_remoteState;
+
+ // Local Moose State
+
+ struct SuffixState
+ {
+ Mac48Address ethernetAddr;
+ Time expirationTime;
+ };
+ std::map<MooseSuffixAddress, PrefixState> m_localState;
+
+};
+
+} // namespace ns3
+
+#endif
--- /dev/null
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * 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: Richard Whitehouse <ns3@richardwhiuk.com>
+ */
+
+#include "bridge-net-device.h"
+#include "moose-bridge-net-device.h"
+#include "bridge-port-net-device.h"
+#include "moose-bridge-port-net-device.h"
+#include "ns3/node.h"
+#include "ns3/channel.h"
+#include "ns3/packet.h"
+#include "ns3/log.h"
+#include "ns3/boolean.h"
+#include "ns3/simulator.h"
+#include "ns3/uinteger.h"
+
+NS_LOG_COMPONENT_DEFINE ("MooseBridgePortNetDevice");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (MooseBridgePortNetDevice);
+
+TypeId
+MooseBridgePortNetDevice::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::MooseBridgePortNetDevice")
+ .SetParent<BridgePortNetDevice> ()
+ ;
+ return tid;
+}
+
+MooseBridgePortNetDevice::MooseBridgePortNetDevice(Ptr<BridgeNetDevice> bridge, Ptr<NetDevice> device, Ptr<Node> node) : BridgePortNetDevice(bridge,device,node){
+ NS_LOG_FUNCTION_NOARGS ();
+}
+
+MooseBridgePortNetDevice::~MooseBridgePortNetDevice(){
+ NS_LOG_FUNCTION_NOARGS ();
+}
+
+}
+
+
--- /dev/null
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * 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: Richard Whitehouse <ns3@richardwhiuk.com>
+ */
+#ifndef MOOSE_BRIDGE_PORT_NET_DEVICE_H
+#define MOOSE_BRIDGE_PORT_NET_DEVICE_H
+
+#include "bridge-port-net-device.h"
+#include "ns3/net-device.h"
+#include "ns3/mac48-address.h"
+#include "ns3/moose-address.h"
+#include "ns3/moose-prefix-address.h"
+#include "ns3/moose-suffix-address.h"
+#include "ns3/nstime.h"
+#include <stdint.h>
+#include <string>
+#include <map>
+
+namespace ns3 {
+
+class Node;
+class BridgeNetDevice;
+
+/**
+ * \ingroup bridge
+ * \brief a port on a virtual net device that bridges multiple LAN segments
+ */
+
+class MooseBridgePortNetDevice : public BridgePortNetDevice {
+
+public:
+ MooseBridgePortNetDevice(Ptr<BridgeNetDevice> bridge, Ptr<NetDevice> device, Ptr<Node> node);
+ virtual ~MooseBridgePortNetDevice();
+
+ static TypeId GetTypeId (void);
+
+};
+
+}
+
+#endif
def build(bld):
obj = bld.create_ns3_module('bridge', ['node'])
obj.source = [
+ 'model/moose-bridge-port-net-device.cc',
+ 'model/moose-bridge-net-device.cc',
'model/bridge-net-device.cc',
'model/bridge-port-net-device.cc',
'model/bridge-channel.cc',
headers = bld.new_task_gen('ns3header')
headers.module = 'bridge'
headers.source = [
+ 'model/moose-bridge-port-net-device.h',
+ 'model/moose-bridge-net-device.h',
'model/bridge-net-device.h',
'model/bridge-port-net-device.h',
'model/bridge-channel.h',
* \returns a multicast address.
*/
static Mac48Address GetMulticast6Prefix (void);
+
private:
/**
* \returns a new Address instance
--- /dev/null
+/* -*- 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: Richard Whitehouse <ns3@richardwhiuk.com>
+ */
+
+#include "moose-address.h"
+#include <map>
+
+namespace ns3 {
+
+MooseAddress::MooseAddress (){
+ memset (m_address, 0, 6);
+}
+
+MooseAddress::MooseAddress (const char *str) {
+ memset (m_address, 0, 6);
+ Mac48Address mac(str);
+ mac.CopyTo(m_address);
+}
+
+MooseAddress::MooseAddress (const Mac48Address &mac) {
+ memset (m_address, 0, 6);
+ mac.CopyTo(m_address);
+}
+
+const MoosePrefixAddress MooseAddress::GetMoosePrefix() const
+{
+ MoosePrefixAddress prefix(m_address + 1);
+ return prefix;
+}
+
+const MooseSuffixAddress MooseAddress::GetMooseSuffix() const
+{
+ MooseSuffixAddress suffix(m_address + 3);
+ return suffix;
+}
+
+const Mac48Address MooseAddress::GetMacAddress() const
+{
+ Mac48Address mac;
+ mac.CopyFrom(m_address);
+ return mac;
+}
+
+bool MooseAddress::IsMoose () const
+{
+ return (m_address[0] & 0x02) == 0x02;
+}
+
+MooseAddress MooseAddress::Allocate()
+{
+ static uint16_t id = 0;
+ ++id;
+
+ MooseAddress moose;
+
+ moose.m_address[0] = 0 | 0x02;
+ moose.m_address[1] = (id >> 8) & 0xff;
+ moose.m_address[2] = (id >> 0) & 0xff;
+
+ return moose;
+}
+
+MooseAddress MooseAddress::Allocate(MoosePrefixAddress prefix){
+
+ static std::map<uint16_t, uint32_t> ids;
+
+ uint16_t key = prefix.GetInt();
+
+ uint16_t val = ++ids[key];
+
+ MooseAddress moose;
+ moose.m_address[0] = 0 | 0x02; // MOOSE Address
+
+ moose.m_address[1] = (key >> 8) & 0xff; // Bridge
+ moose.m_address[2] = (key >> 0) & 0xff;
+
+ moose.m_address[3] = (val >> 16) & 0xff; // Port
+ moose.m_address[4] = (val >> 8) & 0xff;
+ moose.m_address[5] = (val >> 0) & 0xff;
+
+ return moose;
+
+}
+
+}
+
--- /dev/null
+/* -*- 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: Richard Whitehouse <ns3@richardwhiuk.com>
+ */
+#ifndef MOOSE_ADDRESS_H
+#define MOOSE_ADDRESS_H
+
+#include "moose-prefix-address.h"
+#include "moose-suffix-address.h"
+#include "mac48-address.h"
+
+namespace ns3 {
+
+class Address;
+
+/**
+ * \ingroup address
+ *
+ * \brief a MOOSE (Multi-Level Object Orientated Ethernet) address
+ *
+ * This class can contain 48 bit MOOSE addresses.
+ */
+class MooseAddress
+{
+public:
+ MooseAddress ();
+ MooseAddress (const char *str);
+ MooseAddress (const Mac48Address &mac);
+
+ /**
+ * \returns true if this is a MOOSE address, false otherwise.
+ */
+
+ bool IsMoose() const;
+
+ /**
+ * \returns the MOOSE prefix
+ */
+
+ const MoosePrefixAddress GetMoosePrefix() const;
+
+ /**
+ * \returns the MOOSE prefix
+ */
+
+ const MooseSuffixAddress GetMooseSuffix() const;
+
+ /**
+ * \returns the Mac48Address
+ */
+
+ const Mac48Address GetMacAddress() const;
+
+ /**
+ * Allocate a new Moose Bridge Address.
+ */
+ static MooseAddress Allocate ();
+
+ /**
+ * Allocate a new Moose Host Address.
+ */
+ static MooseAddress Allocate (MoosePrefixAddress prefix);
+
+private:
+
+ uint8_t m_address[6];
+
+};
+
+}
+
+#endif
+
--- /dev/null
+/* -*- 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: Richard Whitehouse <ns3@richardwhiuk.com>
+ */
+
+#include "moose-prefix-address.h"
+
+namespace ns3 {
+
+MoosePrefixAddress::MoosePrefixAddress (){
+ memset (m_address, 0, 2);
+}
+
+MoosePrefixAddress::MoosePrefixAddress(const uint8_t buffer[2]){
+ memcpy(m_address, buffer, 2);
+}
+
+const uint16_t MoosePrefixAddress::GetInt() const{
+ uint16_t i;
+ i = m_address[0];
+ i += m_address[1] << 8;
+ return i;
+}
+
+
+}
--- /dev/null
+/* -*- 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: Richard Whitehouse <ns3@richardwhiuk.com>
+ */
+#ifndef MOOSE_PREFIX_ADDRESS_H
+#define MOOSE_PREFIX_ADDRESS_H
+
+#include <ostream>
+#include <string.h>
+#include <stdint.h>
+
+namespace ns3 {
+
+class MoosePrefixAddress {
+
+public:
+ MoosePrefixAddress();
+ MoosePrefixAddress(const uint8_t buffer[2]);
+ const uint16_t GetInt() const;
+
+private:
+
+ uint8_t m_address[2];
+
+ friend bool operator < (const MoosePrefixAddress &a, const MoosePrefixAddress &b);
+ friend bool operator == (const MoosePrefixAddress &a, const MoosePrefixAddress &b);
+ friend bool operator != (const MoosePrefixAddress &a, const MoosePrefixAddress &b);
+ friend std::istream& operator>> (std::istream& is, MoosePrefixAddress & address);
+
+ friend class MooseAddress;
+
+};
+
+/**
+ * \class ns3::Mac48AddressValue
+ * \brief hold objects of type ns3::Mac48Address
+ */
+
+inline bool operator == (const MoosePrefixAddress &a, const MoosePrefixAddress &b)
+{
+ return memcmp (a.m_address, b.m_address, 2) == 0;
+}
+inline bool operator != (const MoosePrefixAddress &a, const MoosePrefixAddress &b)
+{
+ return memcmp (a.m_address, b.m_address, 2) != 0;
+}
+inline bool operator < (const MoosePrefixAddress &a, const MoosePrefixAddress &b)
+{
+ return memcmp (a.m_address, b.m_address, 2) < 0;
+}
+
+std::istream& operator>> (std::istream& is, MoosePrefixAddress & address);
+
+} // namespace ns3
+
+
+#endif
--- /dev/null
+/* -*- 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: Richard Whitehouse <ns3@richardwhiuk.com>
+ */
+
+#include "moose-suffix-address.h"
+
+namespace ns3 {
+
+MooseSuffixAddress::MooseSuffixAddress (){
+ memset (m_address, 0, 6);
+}
+
+MooseSuffixAddress::MooseSuffixAddress(const uint8_t buffer[3]){
+ memcpy(m_address, buffer, 3);
+}
+
+
+
+}
--- /dev/null
+/* -*- 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: Richard Whitehouse <ns3@richardwhiuk.com>
+ */
+#ifndef MOOSE_SUFFIX_ADDRESS_H
+#define MOOSE_SUFFIX_ADDRESS_H
+
+#include <string.h>
+#include <ostream>
+#include <stdint.h>
+
+namespace ns3 {
+
+class MooseSuffixAddress {
+
+public:
+ MooseSuffixAddress();
+ MooseSuffixAddress(const uint8_t buffer[3]);
+
+private:
+
+ uint8_t m_address[6];
+
+ friend bool operator < (const MooseSuffixAddress &a, const MooseSuffixAddress &b);
+ friend bool operator == (const MooseSuffixAddress &a, const MooseSuffixAddress &b);
+ friend bool operator != (const MooseSuffixAddress &a, const MooseSuffixAddress &b);
+ friend std::istream& operator>> (std::istream& is, MooseSuffixAddress & address);
+
+};
+
+/**
+ * \class ns3::Mac48AddressValue
+ * \brief hold objects of type ns3::Mac48Address
+ */
+
+inline bool operator == (const MooseSuffixAddress &a, const MooseSuffixAddress &b)
+{
+ return memcmp (a.m_address, b.m_address, 3) == 0;
+}
+inline bool operator != (const MooseSuffixAddress &a, const MooseSuffixAddress &b)
+{
+ return memcmp (a.m_address, b.m_address, 3) != 0;
+}
+inline bool operator < (const MooseSuffixAddress &a, const MooseSuffixAddress &b)
+{
+ return memcmp (a.m_address, b.m_address, 3) < 0;
+}
+
+std::istream& operator>> (std::istream& is, MooseSuffixAddress & address);
+
+} // namespace ns3
+
+#endif
node.source = [
'address.cc',
'mac48-address.cc',
+ 'moose-address.cc',
+ 'moose-prefix-address.cc',
+ 'moose-suffix-address.cc',
'mac64-address.cc',
'inet-socket-address.cc',
'packet-socket-address.cc',
headers.source = [
'address.h',
'mac48-address.h',
+ 'moose-address.h',
+ 'moose-prefix-address.h',
+ 'moose-suffix-address.h',
'mac64-address.h',
'inet-socket-address.h',
'packet-socket-address.h',