diff -r -u nanonetworks/model/backoff-based-nano-mac-entity.cc ns-allinone-3.16/ns-3.16/src/nanonetworks/model/backoff-based-nano-mac-entity.cc --- nanonetworks/model/backoff-based-nano-mac-entity.cc 2013-01-16 11:03:16.000000000 +0100 +++ ns-allinone-3.16/ns-3.16/src/nanonetworks/model/backoff-based-nano-mac-entity.cc 2014-01-17 16:25:30.996601991 +0100 @@ -74,7 +74,7 @@ if (m_neighbors.size ()) { - srand ( time(NULL) ); + //srand ( time(NULL) ); // if (phy->GetState () == NanoSpectrumPhy::IDLE || phy->GetState () == NanoSpectrumPhy::RX) // { diff -r -u nanonetworks/model/flooding-nano-routing-entity.cc ns-allinone-3.16/ns-3.16/src/nanonetworks/model/flooding-nano-routing-entity.cc --- nanonetworks/model/flooding-nano-routing-entity.cc 2013-01-16 11:03:16.000000000 +0100 +++ ns-allinone-3.16/ns-3.16/src/nanonetworks/model/flooding-nano-routing-entity.cc 2014-01-20 11:49:35.049569060 +0100 @@ -44,6 +44,7 @@ #include "nano-routing-entity.h" #include "message-process-unit.h" +#include "ns3/multimedia-application-receiver.h" NS_LOG_COMPONENT_DEFINE ("FloodingNanoRoutingEntity"); @@ -85,6 +86,8 @@ void FloodingNanoRoutingEntity::SendPacket (Ptr p) { + std::cout << "eugen FloodingNanoRoutingEntity::SendPacket, id=" << p->GetUid() << "\n"; + NS_LOG_FUNCTION (this << p << "size" << p->GetSize ()); SeqTsHeader seqTs; @@ -126,6 +129,9 @@ mac->Send (p, dst); } +Ptr ppp; +Ptr multimediaReceiver; + void FloodingNanoRoutingEntity::ReceivePacket (Ptr pkt) { @@ -144,6 +150,7 @@ NS_LOG_FUNCTION (this << l3Header); uint32_t id = l3Header.GetPacketId (); + std::cout << "eugen FloodingNanoRoutingEntity::ReceivePacket " << id << ", id=" << p->GetUid() << "\n"; bool alreadyReceived = CheckAmongReceivedPacket (id); UpdateReceivedPacketId (id); //CheckAmongReceivedPacket (id); @@ -153,6 +160,16 @@ if (!alreadyReceived) { NS_LOG_FUNCTION (this << "received a packet for the first time"); + std::cout << "toto " << GetDevice () -> m_apps << "\n"; + if (GetDevice () -> m_apps == 1) { // dest + ppp = p; + multimediaReceiver->OnReceive (NULL); + } else { // router => forward it + p->AddHeader (l3Header); + ForwardPacket (p); + } // check source too? + + /* if (GetDevice ()->GetMessageProcessUnit () && type == SimpleNanoDevice::NanoInterface) { NS_LOG_FUNCTION (this << GetDevice()->GetNode ()->GetId () << l3Header.GetSource () << l3Header.GetDestination () << "FOR ME"); @@ -179,6 +196,7 @@ NS_LOG_FUNCTION (this << "do nothing!"); } } + */ } else { @@ -190,6 +208,8 @@ void FloodingNanoRoutingEntity::ForwardPacket (Ptr p) { + std::cout << "eugen FloodingNanoRoutingEntity::ForwardPacket\n"; + NS_LOG_FUNCTION (this << p << "size" << p->GetSize ()); NanoL3Header l3Header; diff -r -u nanonetworks/model/random-nano-routing-entity.cc ns-allinone-3.16/ns-3.16/src/nanonetworks/model/random-nano-routing-entity.cc --- nanonetworks/model/random-nano-routing-entity.cc 2013-01-16 11:03:18.000000000 +0100 +++ ns-allinone-3.16/ns-3.16/src/nanonetworks/model/random-nano-routing-entity.cc 2014-01-17 16:25:49.768695129 +0100 @@ -123,14 +123,14 @@ if (newNeighbors.size () != 0) { NS_LOG_FUNCTION (this << "I can choose a router/interface"); - srand ( time(NULL) ); + //srand ( time(NULL) ); int i = rand () %newNeighbors.size(); macdst = newNeighbors.at (i).first; } else { NS_LOG_FUNCTION (this << "I can choose only a nanonode"); - srand ( time(NULL) ); + //srand ( time(NULL) ); int i = rand () %neighbors.size(); macdst = neighbors.at (i).first; } @@ -214,7 +214,7 @@ if (ttl > 1) { - srand ( time(NULL) ); + //srand ( time(NULL) ); if (GetDevice ()->m_type == SimpleNanoDevice::NanoRouter) {