Mehic.info

Category Archives: ns3

Crypto++ VMAC issue

Well, I tried code available on http://www.cryptopp.com/wiki/VMAC in my NS-3 project on the following way: inputString = base64_encode (inputString); byte* Kkey = key->GetKey(); byte digestBytes[key->GetSize()]; byte digestBytes2[key->GetSize()]; CryptoPP::VMAC vmac; vmac.SetKeyWithIV(Kkey, key->GetSize(), m_iv, CryptoPP::AES::BLOCKSIZE); vmac.CalculateDigest(digestBytes, (byte *) inputString.c_str(), inputString.length()); //VMAC Verification vmac.SetKeyWithIV(Kkey, key->GetSize(), m_iv, CryptoPP::AES::BLOCKSIZE); vmac.CalculateDigest(digestBytes2, (byte *) inputString.c_str(), inputString.length()); std::string outputString = std::string( (char*)digestBytes, sizeof(digestBytes […]

Read more

Installing crypto++ with ns3

Installing crypto++ (libcryptopp) on Ubuntu sudo apt-get install libcrypto++-dev libcrypto++-doc libcrypto++-utils On distributions which use yum (such as Fedora): yum install cryptopp cryptopp-devel More details on: http://stackoverflow.com/questions/19187990/installing-crypto-libcryptopp-on-ubuntu and https://www.cryptopp.com/wiki/Linux Then compile and run some test.cc source file Make testcode.cc which contains following: /* -*- Mode:C++; c-file-style:”gnu”; indent-tabs-mode:nil; -*- */ #include <iostream> int main (int argc, […]

Read more

Greedy Perimeter Stateless Routing (GPSR) in ns3.25

Please find the updated Greedy Perimeter Stateless Routing protocol (GPSR) code which works in the latest ns3.25 version. Just copy it into your /src folder and execute “./waf configure” and “./waf”. Also, move the examples from /src/gprs/examples to /scratch and test it. It works fine for me in ns3.25 version. Enjoy! — Files to download: […]

Read more

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 olsr-routing-protocol.cc 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