Category Archives: Networks and telecommunications

Posts related to networks or telecommunications topic.

IP ToS fields with UDPSockets – implementation issue

For the purposes of my project, I needed to add TOS tag to UDP packets which are generated by OLSR routing protocol. In I added ToS Values: // Create a socket to listen only on this interface Ptr socket = Socket::CreateSocket (GetObject (),UdpSocketFactory::GetTypeId ()); socket->SetAllowBroadcast (true); socket->SetIpTos(6); socket->SetIpRecvTos(true); And when I executed the code […]

Read more

Add and read content to Packet payload in NS3

To add content to packet payload you can use following commands: std::ostringstream msg; msg << “Hello World!” << ‘\0’; Ptr<Packet> packet = Create<Packet> ((uint8_t*) msg.str().c_str(), msg.str().length()); To read content from packet payload: uint8_t *buffer = new uint8_t[packet->GetSize ()]; packet->CopyData(buffer, packet->GetSize ()); std::string s = std::string((char*)buffer);

Read more

NS3 – undefined reference to..

I received following bug when I tried to install new module and build NS3 : ./ undefined reference to `ns3::Queue::IsFull() const’ collect2: error: ld returned 1 exit status The problem was that my was calling function return !(m_queue->IsFull ()); which was not implemented in src/networking/utils/ The function was declared in queue.h as virtual but […]

Read more

How to print routing tables of DSDV in NS3?

Open “src/dsdv/model/dsdv-routing-protocol.h” and add  “Ptr routingStream;” in public attributes: class RoutingProtocol : public Ipv4RoutingProtocol { public: …. virtual void DoDispose (); Ptr routingStream; … Then in “src/dsdv/model/” at line 250 add the new function: void RoutingProtocol::PrintRoutingTable (Ptr stream) const { *stream->GetStream () GetId ()

Read more