--- /dev/null
+
+#include "ns3/packet.h"
+#include "ns3/log.h"
+#include "ns3/node.h"
+#include "rstp-l3-protocol.h"
+
+NS_LOG_COMPONENT_DEFINE("RstpL3Protocol");
+
+namespace ns3 {
+
+const uint16_t RstpL3Protocol::PROT_NUMBER = 0x0; // TODO
+
+NS_OBJECT_ENSURE_REGISTERED (RstpL3Protocol);
+
+TypeId RstpL3Protocol::GetTypeId(void){
+ static TypeId tid = TypeId("ns3::RstpL3Protocol")
+ .SetParent<Object> ()
+ .AddConstructor<RstpL3Protocol> ();
+
+ return tid;
+}
+
+RstpL3Protocol::RstpL3Protocol(){
+ NS_LOG_FUNCTION(this);
+}
+
+RstpL3Protocol::~RstpL3Protocol(){
+ NS_LOG_FUNCTION(this);
+}
+
+void RstpL3Protocol::SetBridge(Ptr<EthernetBridgeNetDevice> bridge){
+ NS_LOG_FUNCTION(this);
+ m_bridge = bridge;
+}
+
+void RstpL3Protocol::SetNode(Ptr<Node> node){
+ NS_LOG_FUNCTION(this);
+ m_node = node;
+}
+
+void RstpL3Protocol::DoDispose(){
+ NS_LOG_FUNCTION(this);
+ m_node = 0;
+ Object::DoDispose();
+}
+
+void RstpL3Protocol::NotifyNewAggregate(){
+ if(m_node == 0){
+ Ptr<Node> node = this->GetObject<Node>();
+
+ if(node != 0){
+ this->SetNode(node);
+ }
+ }
+ if(m_bridge == 0){
+ Ptr<EthernetBridgeNetDevice> bridge = this->GetObject<EthernetBridgeNetDevice>();
+
+ if(bridge != 0){
+ this->SetBridge(bridge);
+ }
+ }
+ Object::NotifyNewAggregate();
+}
+
+}
+
--- /dev/null
+
+#ifndef RSTP_L3_PROTOCOL_H
+#define RSTP_L3_PROTOCOL_H
+
+#include "ethernet-bridge-net-device.h"
+
+namespace ns3 {
+
+/**
+ * \ingroup bridge
+ * \brief Implement the Rapid Spanning Tree Protocol (RSTP)
+ *
+ * This is the implementation of RSTP
+**/
+
+class RstpL3Protocol : public Object {
+
+public:
+ static TypeId GetTypeId (void);
+ static const uint16_t PROT_NUMBER;
+
+ RstpL3Protocol ();
+ virtual ~RstpL3Protocol ();
+
+ void SetNode(Ptr<Node> node);
+ void SetBridge(Ptr<EthernetBridgeNetDevice> bridge);
+
+ /**
+ * \brief Recieve a packet
+ */
+
+ void Receive(Ptr<NetDevice> device, Ptr<const Packet> p, uint16_t protocol, const Address &from, const Address &to, NetDevice::PacketType packetType);
+
+protected:
+
+ virtual void DoDispose();
+ virtual void NotifyNewAggregate();
+
+private:
+
+ RstpL3Protocol(const RstpL3Protocol &o);
+ RstpL3Protocol &operator=(const RstpL3Protocol &o);
+
+ Ptr<EthernetBridgeNetDevice> m_bridge;
+ Ptr<Node> m_node;
+
+};
+
+
+}
+
+#endif
+
'model/configuration-bpdu-header.cc',
'model/tcn-bpdu-header.cc',
'model/rst-bpdu-header.cc',
+ 'model/rstp-l3-protocol.cc',
'helper/ethernet-bridge-helper.cc',
]
headers = bld.new_task_gen('ns3header')
headers.module = 'bridge'
headers.source = [
'model/bpdu-header.h',
+ 'model/rstp-l3-protocol.h',
'model/ethernet-bridge-state.h',
'model/ethernet-bridge-port-net-device.h',
'model/ethernet-bridge-net-device.h',