⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aodv.pc

📁 aodv program to simulate in glomosim simulator
💻 PC
📖 第 1 页 / 共 5 页
字号:
		  current->valid = FALSE;		  current->lifetime = simclock() + RoutingAodvGetDeletePeriod();		  RoutingAodvSetTimer(node,MSG_AODV_DeleteRouteEntry,current->destAddr,RoutingAodvGetDeletePeriod());		  NetworkIpDeleteOutboundPacketsToANode(node, srcAddr, destAddr, FALSE);		}	    	      newRerrPacket.destinationPairArray[newRerrPacket.destinationCount].destinationAddress = destAddr;	      newRerrPacket.destinationPairArray[newRerrPacket.destinationCount].destinationSequenceNumber = seqNum;	      newRerrPacket.destinationCount++;		      RoutingAodvGetPrecursors(node,destAddr,&precursorList); 	      	    }//i too lost route to destAddr	    	    	}//entry for destAddr existed in my route table	                                 }//for//        if (newRerrPacket.destinationCount > 0)       {		if(precursorList.size>0)	  {	    SendRouteErrorPacket(node, &newRerrPacket,&precursorList);	    aodv->stats.numRerrSent++;	  }      }//if//    GLOMO_MsgFree(node, msg);}//RoutingAodvHandleRouteError///* * RoutingAodvInitRouteTable * * Initialize the route table */void RoutingAodvInitRouteTable(AODV_RT *routeTable){    routeTable->head = NULL;    routeTable->size = 0;} /* RoutingAodvInitRouteTable *//* * RoutingAodvInitNbrTable * * Initialize the neighbor table */void RoutingAodvInitNbrTable(AODV_NT *nbrTable){    nbrTable->head = NULL;    nbrTable->size = 0;} /* RoutingAodvInitNbrTable *//* * RoutingAodvInitSeenTable * * Initialize the seen table */void RoutingAodvInitSeenTable(AODV_RST *seenTable){    seenTable->front = NULL;    seenTable->rear = NULL;    seenTable->size = 0;} /* RoutingAodvInitSeenTable *//* * RoutingAodvInitBuffer * * Initialize the buffer */void RoutingAodvInitBuffer(AODV_BUFFER *buffer){    buffer->head = NULL;    buffer->size = 0;} /* RoutingAodvInitBuffer *//* * RoutingAodvInitSent * * Initialize the sent table */void RoutingAodvInitSent(AODV_SENT *sent){    sent->head = NULL;    sent->size = 0;} /* RoutingAodvInitBuffer *//* * RoutingAodvInitStats * * Initialize all the stat variables */void RoutingAodvInitStats(GlomoNode *node){    GlomoNetworkIp* ipLayer = (GlomoNetworkIp *) node->networkData.networkVar;    GlomoRoutingAodv* aodv = (GlomoRoutingAodv *) ipLayer->routingProtocol;    aodv->stats.numRequestSent = 0;    aodv->stats.numRequestOrig = 0;    aodv->stats.numReplySent = 0;    aodv->stats.numReplySentAsDest = 0;    aodv->stats.numReplySentAsIn = 0;    aodv->stats.numGratuitousReplySent = 0;    aodv->stats.numReplyAckSent = 0;    aodv->stats.numRerrSent = 0;    aodv->stats.numRerrNoNSent = 0;    aodv->stats.numRerrNSent = 0;    aodv->stats.numDataSent = 0;    aodv->stats.numDataTxed = 0;    aodv->stats.numDataReceived = 0;    aodv->stats.numRoutes = 0;    aodv->stats.numHops = 0;    aodv->stats.numDestUnrchSent = 0;    aodv->stats.numPacketsDropped = 0;    aodv->stats.numBrokenLinks = 0;#ifdef HELLO_PACKETS    aodv->stats.numHelloSent = 0;#endif#ifdef LOCAL_REPAIR    aodv->stats.numAttemptsLocalRepair = 0;    aodv->stats.numSuccessfulLocalRepair = 0;#endif} /* RoutingAodvInitStats *//* * RoutingAodvInitSeq * * Initialize the sequence number */void RoutingAodvInitSeq(GlomoNode *node){    GlomoNetworkIp* ipLayer = (GlomoNetworkIp *) node->networkData.networkVar;    GlomoRoutingAodv* aodv = (GlomoRoutingAodv *) ipLayer->routingProtocol;    aodv->seqNumber = 0;} /* RoutingAodvInitSeq *//* * RoutingAodvInitBcastId * * Initialize the broadcast id */void RoutingAodvInitBcastId(GlomoNode *node){    GlomoNetworkIp* ipLayer = (GlomoNetworkIp *) node->networkData.networkVar;    GlomoRoutingAodv* aodv = (GlomoRoutingAodv *) ipLayer->routingProtocol;    aodv->bcastId = 0;} /* RoutingAodvInitBcastId *//* * RoutingAodvGetNextHop * * Looks up the routing table to obtain next hop to the destinaton */NODE_ADDR RoutingAodvGetNextHop(NODE_ADDR destAddr, AODV_RT *routeTable){    AODV_RT_Node *current;    for (current = routeTable->head;         current != NULL && current->destAddr <= destAddr;          current = current->next)    {        if (current->destAddr == destAddr)        {            return(current->nextHop);        }    }    return (ANY_DEST);} /* RoutingAodvGetNextHop *//* * RoutingAodvGetBcastId * * Obtains the broadcast ID for the outgoing packet */int RoutingAodvGetBcastId(GlomoNode *node){    GlomoNetworkIp* ipLayer = (GlomoNetworkIp *) node->networkData.networkVar;    GlomoRoutingAodv* aodv = (GlomoRoutingAodv *) ipLayer->routingProtocol;    int bcast;    bcast = aodv->bcastId;    aodv->bcastId++;    return (bcast);} /* RoutingAodvGetBcastId *//* * RoutingAodvGetSeq * * Obtains the sequence number of the destination node  */int RoutingAodvGetSeq(NODE_ADDR destAddr, AODV_RT *routeTable){    AODV_RT_Node *current;    for (current = routeTable->head;         current != NULL && current->destAddr <= destAddr;         current = current->next)    {        if ((current->destAddr == destAddr)&&(current->destSeqValid==TRUE))        {            return(current->destSeq);        }    }    return (-1);} /* RoutingAodvGetSeq *//* * RoutingAodvGetMySeq * * Obtains the node's seq number */int RoutingAodvGetMySeq(GlomoNode *node){    GlomoNetworkIp* ipLayer = (GlomoNetworkIp *) node->networkData.networkVar;    GlomoRoutingAodv* aodv = (GlomoRoutingAodv *) ipLayer->routingProtocol;    return (aodv->seqNumber);} /* RoutingAodvGetMySeq *//* * RoutingAodvGetHopCount * * Obtains the hop count to the destination node */int RoutingAodvGetHopCount(NODE_ADDR destAddr, AODV_RT *routeTable){    AODV_RT_Node *current;    for (current = routeTable->head;         current != NULL && current->destAddr <= destAddr;         current = current->next)    {        if (current->destAddr == destAddr)        {            return(current->hopCount);        }    }    return (-1);} /* RoutingAodvGetHopCount *//* * RoutingAodvGetTtl * * Obtains the ttl value for the outgoing RREQ */int RoutingAodvGetTtl(NODE_ADDR destAddr, AODV_SENT *sent){    AODV_SENT_Node *current;    for (current = sent->head;         current != NULL && current->destAddr <= destAddr;         current = current->next)    {        if (current->destAddr == destAddr)        {            return(current->ttl);        }    }    return (TTL_START);} /* RoutingAodvGetTtl *//* * RoutingAodvGetTimes * * Obtains the number of times the RREQ was sent in TTL = NET_DIAMETER */int RoutingAodvGetTimes(NODE_ADDR destAddr, AODV_SENT *sent){    AODV_SENT_Node *current;    for (current = sent->head;         current != NULL && current->destAddr <= destAddr;         current = current->next)    {        if (current->destAddr == destAddr)        {            return(current->times);        }    }    return (0);} /* RoutingAodvGetTimes *//* * RoutingAodvGetLifetime * * Obtains the lifetime value of an entry in the route table */clocktype RoutingAodvGetLifetime(NODE_ADDR destAddr, AODV_RT *routeTable){    AODV_RT_Node *current;    for (current = routeTable->head;         current != NULL && current->destAddr <= destAddr;         current = current->next)    {        if (current->destAddr == destAddr)        {            return(current->lifetime);        }    }    return (0);} /* RoutingAodvGetLifetime *//* * RoutingAodvGetBufferedPacket * * Extract the packet that was buffered */Message *RoutingAodvGetBufferedPacket(NODE_ADDR destAddr, AODV_BUFFER *buffer){    AODV_BUFFER_Node *current;    for (current = buffer->head;         current != NULL && current->destAddr <= destAddr;         current = current->next)    {        if (current->destAddr == destAddr)        {            return(current->msg);        }    }    assert(FALSE); abort(); return NULL;} /* RoutingAodvGetBufferedPacket *//* * RoutingAodvGetLastPacketTime * * returns the last time a packet was received from this neighbor */clocktype RoutingAodvGetLastPacketTime(GlomoNode *node, NODE_ADDR nbrAddr){  GlomoNetworkIp* ipLayer = (GlomoNetworkIp *) node->networkData.networkVar;  GlomoRoutingAodv* aodv = (GlomoRoutingAodv *) ipLayer->routingProtocol;  AODV_NT nbrTable = aodv->nbrTable;  AODV_NT_Node *current;  for (current = nbrTable.head;       current != NULL && current->nbrAddr <= nbrAddr;       current = current->next)    {      if(current->nbrAddr==nbrAddr)	{	  return current->lastPkt;	}    }  return 0;} /* RoutingAodvGetLastPacketTime*//* * RoutingAodvCheckRouteExist *  * Returns TRUE if any route to the destination is known */BOOL RoutingAodvCheckRouteExist(NODE_ADDR destAddr, AODV_RT *routeTable){    AODV_RT_Node *current;    if (routeTable->size == 0)    {        return (FALSE);    }    for (current = routeTable->head;         current != NULL && current->destAddr <= destAddr;         current = current->next)    {        if ((current->destAddr == destAddr) &&             (current->lifetime > simclock()) &&            (current->valid == TRUE))        {            return(TRUE);        }    }    return (FALSE);} /* RoutingAodvCheckRouteExist *//* * RoutingAodvCheckRouteEntryExist * * Checks whether corresponding entry exists for destAddr in the route table */ BOOL RoutingAodvCheckRouteEntryExist(NODE_ADDR destAddr, AODV_RT *routeTable){    AODV_RT_Node *current;    if(routeTable->size==0)    {        return(FALSE);	        }        for(current=routeTable->head;        current !=NULL && current->destAddr <=destAddr;	current = current->next)    {	if(current->destAddr==destAddr)	{	    return TRUE;		}	    }    return FALSE;}/* * RoutingAodvCheckBeingRepaired * * Returns TRUE if the route for the destAddr is being repaired i.e. the beingRepaired flag is set */ BOOL RoutingAodvCheckBeingRepaired(NODE_ADDR destAddr, A

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -