Hi,
I want to obtain the Ipaddress and HopLimit count attached in IpHeader. I was able to do the 1st part successfully, but unable to get the hoplimit count.
void ReceivePacket (Ptr<Socket> socket)
{
Address from;
Ptr<Packet> packet = socket->RecvFrom (from);
packet->RemoveAllPacketTags ();
packet->RemoveAllByteTags ();
uint8_t buf[packet->GetSize()]; // Create storage for pkt data
packet->CopyData (buf, packet->GetSize()); // Dump pkt data in buf
Inet6SocketAddress ipAddress = Inet6SocketAddress::ConvertFrom (from);
Ipv6Address add = ipAddress.GetIpv6();
NS_LOG_INFO("add="<<add);
Ipv6Header ipv6Header;
packet->RemoveHeader(ipv6Header);
NS_LOG_INFO("hoplimit="<<ipv6Header.GetHopLimit());
while (socket->Recv ())
{
NS_LOG_UNCOND ("Received one packet!");
}
}
get the following assert failure for hoplimit part
assert failed. cond="(m_version) == 6", file=../src/internet/model/ipv6-header.cc, line=172
terminate called without an active exception
I don't understand why the version is not matching, when the whole process uses only Ipv6 addressing. Or am i accessing the Ipv6Header in a wrong fashion.
Please let me know.
Any help would be greatly appreciated.
Regards
Shashidhar B.L