problem with protocol number fixed
This commit is contained in:
@@ -86,6 +86,7 @@ Icmpv4L4Protocol::SendMessage (Ptr<Packet> packet, Ipv4Address dest, uint8_t typ
|
||||
NS_ASSERT (ipv4 != 0 && ipv4->GetRoutingProtocol () != 0);
|
||||
Ipv4Header header;
|
||||
header.SetDestination (dest);
|
||||
header.SetProtocol (PROT_NUMBER);
|
||||
Socket::SocketErrno errno_;
|
||||
Ptr<Ipv4Route> route;
|
||||
uint32_t oif = 0; //specify non-zero if bound to a source address
|
||||
|
||||
@@ -174,6 +174,7 @@ Ipv4RawSocketImpl::SendTo (Ptr<Packet> p, uint32_t flags,
|
||||
{
|
||||
Ipv4Header header;
|
||||
header.SetDestination (dst);
|
||||
header.SetProtocol (m_protocol);
|
||||
SocketErrno errno_ = ERROR_NOTERROR;//do not use errno as it is the standard C last error number
|
||||
Ptr<Ipv4Route> route;
|
||||
uint32_t oif = 0; //specify non-zero if bound to a source address
|
||||
|
||||
@@ -549,6 +549,7 @@ TcpL4Protocol::Send (Ptr<Packet> packet,
|
||||
// should be cached.
|
||||
Ipv4Header header;
|
||||
header.SetDestination (daddr);
|
||||
header.SetProtocol (PROT_NUMBER);
|
||||
Socket::SocketErrno errno_;
|
||||
Ptr<Ipv4Route> route;
|
||||
uint32_t oif = 0; //specify non-zero if bound to a source address
|
||||
@@ -587,6 +588,7 @@ TcpL4Protocol::SendPacket (Ptr<Packet> packet, TcpHeader outgoingHeader,
|
||||
// should be cached.
|
||||
Ipv4Header header;
|
||||
header.SetDestination (daddr);
|
||||
header.SetProtocol (PROT_NUMBER);
|
||||
Socket::SocketErrno errno_;
|
||||
Ptr<Ipv4Route> route;
|
||||
uint32_t oif = 0; //specify non-zero if bound to a source address
|
||||
|
||||
@@ -403,6 +403,7 @@ UdpSocketImpl::DoSendTo (Ptr<Packet> p, Ipv4Address dest, uint16_t port)
|
||||
{
|
||||
Ipv4Header header;
|
||||
header.SetDestination (dest);
|
||||
header.SetProtocol (UdpL4Protocol::PROT_NUMBER);
|
||||
Socket::SocketErrno errno_;
|
||||
Ptr<Ipv4Route> route;
|
||||
uint32_t oif = 0; //specify non-zero if bound to a source address
|
||||
|
||||
@@ -178,7 +178,7 @@ RoutingProtocol::Start ()
|
||||
Ptr<Ipv4Route>
|
||||
RoutingProtocol::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, uint32_t oif, Socket::SocketErrno &sockerr )
|
||||
{
|
||||
NS_LOG_FUNCTION (this << p->GetUid() << header.GetDestination());
|
||||
NS_LOG_FUNCTION (this << header.GetDestination());
|
||||
if (m_socketAddresses.empty ())
|
||||
{
|
||||
sockerr = Socket::ERROR_NOROUTETOHOST;
|
||||
@@ -203,9 +203,17 @@ RoutingProtocol::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, uint32_t
|
||||
}
|
||||
else
|
||||
{
|
||||
QueueEntry newEntry (p, header, m_scb, m_ecb);
|
||||
m_queue.Enqueue (newEntry);
|
||||
if (rt.GetFlag () == INVALID)
|
||||
bool result = true;
|
||||
// May be null pointer (e.g. tcp-socket give null pointer)
|
||||
if (p != Ptr<Packet> ())
|
||||
{
|
||||
QueueEntry newEntry (p, header, m_scb, m_ecb);
|
||||
result = m_queue.Enqueue (newEntry);
|
||||
if (result)
|
||||
NS_LOG_LOGIC ("Add packet " << p->GetUid() << " to queue");
|
||||
|
||||
}
|
||||
if (rt.GetFlag () == INVALID && result)
|
||||
{
|
||||
m_routingTable.SetEntryState (dst, IN_SEARCH);
|
||||
SendRequest (dst);
|
||||
@@ -214,9 +222,17 @@ RoutingProtocol::RouteOutput (Ptr<Packet> p, const Ipv4Header &header, uint32_t
|
||||
}
|
||||
else
|
||||
{
|
||||
QueueEntry newEntry (p, header, m_scb, m_ecb);
|
||||
m_queue.Enqueue (newEntry);
|
||||
SendRequest (dst);
|
||||
bool result = true;
|
||||
if (p != Ptr<Packet> ())
|
||||
{
|
||||
QueueEntry newEntry (p, header, m_scb, m_ecb);
|
||||
// Some protocols may ask route several times for a single packet.
|
||||
result = m_queue.Enqueue (newEntry);
|
||||
if (result)
|
||||
NS_LOG_LOGIC ("Add packet " << p->GetUid() << " to queue");
|
||||
}
|
||||
if (result)
|
||||
SendRequest (dst);
|
||||
}
|
||||
return route;
|
||||
}
|
||||
@@ -1196,12 +1212,12 @@ RoutingProtocol::SendPacketFromQueue (Ipv4Address dst, Ptr<Ipv4Route> route )
|
||||
void
|
||||
RoutingProtocol::Send (Ptr<Ipv4Route> route, Ptr<const Packet> packet, const Ipv4Header & header )
|
||||
{
|
||||
NS_LOG_FUNCTION(this << packet->GetUid() << (uint16_t) header.GetProtocol());
|
||||
NS_LOG_FUNCTION (this << packet->GetUid() << (uint16_t) header.GetProtocol());
|
||||
Ptr<Ipv4L3Protocol> l3 = m_ipv4->GetObject<Ipv4L3Protocol> ();
|
||||
NS_ASSERT(l3 != 0);
|
||||
Ptr<Packet> p = packet->Copy ();
|
||||
// TODO know protocol number
|
||||
l3->Send (p, route->GetSource (), header.GetDestination (), 1, route);
|
||||
l3->Send (p, route->GetSource (), header.GetDestination (), header.GetProtocol(), route);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -182,7 +182,7 @@ private:
|
||||
/// Receive RREP
|
||||
void RecvReply (Ptr<Packet> p, Ipv4Address my ,Ipv4Address src);
|
||||
/// Receive RREP_ACK
|
||||
void RecvReplyAck(Ipv4Address neighbor);
|
||||
void RecvReplyAck (Ipv4Address neighbor);
|
||||
/// Receive RERR from node with address src
|
||||
void RecvError (Ptr<Packet> p, Ipv4Address src);
|
||||
//\}
|
||||
|
||||
@@ -98,18 +98,22 @@ RequestQueue::GetSize ()
|
||||
return m_queue.size ();
|
||||
}
|
||||
|
||||
void
|
||||
bool
|
||||
RequestQueue::Enqueue (QueueEntry & entry )
|
||||
{
|
||||
Purge ();
|
||||
for (std::vector<QueueEntry>::const_iterator i = m_queue.begin (); i != m_queue.end (); ++i)
|
||||
if ((i->GetPacket ()->GetUid () == entry.GetPacket ()->GetUid ()) &&
|
||||
(i->GetIpv4Header ().GetDestination () == entry.GetIpv4Header ().GetDestination ()))
|
||||
return false;
|
||||
entry.SetExpireTime (m_queueTimeout);
|
||||
|
||||
if (m_queue.size () == m_maxLen)
|
||||
{
|
||||
Drop (m_queue.front (), "Drop the most aged packet"); // Drop the most aged packet
|
||||
m_queue.erase (m_queue.begin ());
|
||||
}
|
||||
m_queue.push_back (entry);
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -94,8 +94,8 @@ class RequestQueue
|
||||
public:
|
||||
/// Default c-tor
|
||||
RequestQueue (uint32_t maxLen, Time routeToQueueTimeout) : m_maxLen (maxLen), m_queueTimeout (routeToQueueTimeout) {}
|
||||
/// Push entry in queue.
|
||||
void Enqueue (QueueEntry & entry);
|
||||
/// Push entry in queue, if there is no entry with the same packet and destination address in queue.
|
||||
bool Enqueue (QueueEntry & entry);
|
||||
/// Return first found (the earliest) entry for given destination
|
||||
bool Dequeue (Ipv4Address dst, QueueEntry & entry);
|
||||
/// Remove all packets with destination IP address dst
|
||||
|
||||
Reference in New Issue
Block a user