Exemple #1
0
 void handleRouteRequest(AodvRReq request, NetworkInterface netInt)
 {
     setRoute(request.Source, netInt);
     if (request.Destination == node)
     {
         AodvRRep          reply  = new AodvRRep(node);
         RoutingInfoBundle bundle = new RoutingInfoBundle(node, request.Source, reply);
         Route(bundle);
     }
 }
Exemple #2
0
    public override void Route(Bundle bundle, NetworkInterface source)
    {
        ++requestsToRoute;
        if (routingTable.Contains(bundle.Destination))
        {
            routingTable[bundle.Destination].NetworkInterface.Send(bundle);
            ++routedBundles;
            return;
        }
        double     bundleDelay = Math.Min(bundle.LifeTimeEnd, Timer.CurrentTime + Configuration.Protocols.Aodv.MaxBundleWaitingTime);
        TimerEntry timerEntry  = Timer.Schedule(bundleDelay, onBundleDelayTooBig, bundle);

        delayedBundles.Add(bundle, timerEntry);
        if (!pendingRequests.Contains(bundle.Destination))
        {
            TimerEntry pendingTimeout = Timer.Schedule(Timer.CurrentTime + Configuration.Protocols.Aodv.MaxBundleWaitingTime, onPendingRequestTimeout, bundle.Destination);
            pendingRequests.Add(bundle.Destination, pendingTimeout);
            AodvRReq          aodvRReq          = new AodvRReq(node, bundle.Destination);
            RoutingInfoBundle routingInfoBundle = new RoutingInfoBundle(node, null, aodvRReq);
            broadcast(routingInfoBundle, null);
        }
    }