📄 nwlar1.h
字号:
//// FUNCTION NetworkLar1NodeInReqPath()// PURPOSE Return TRUE if node address appears in path array// PARAMETERS path - array of NODE_ADDR// hopcount- number of entries in path array//BOOL NetworkLar1NodeInReqPath(GlomoNode *node, NODE_ADDR *path, int hopcount);//// FUNCTION NetworkLar1FlushRequestSeenCache()// PURPOSE Remove Request Seen Cache entries older than// LAR1_REQUEST_SEEN_LIFETIME// PARAMETERS lar1 - LAR1 variable space//void NetworkLar1FlushRequestSeenCache(GlomoNetworkLar1 *lar1);//// FUNCTION NetworkLar1InsertRequestSeen()// PURPOSE Insert Request source address and sequence num into cache// PARAMETERS sourceAddr - source of LAR Request Packet// seqNum - sequence number assigned by source//void NetworkLar1InsertRequestSeen(GlomoNetworkLar1 *lar1, NODE_ADDR sourceAddr, int seqNum);//// FUNCTION NetworkLar1InsertRequestSent()// PURPOSE Insert destination address for locally generated// LAR Request Packet into cache// PARAMETERS destAddr - destination address//void NetworkLar1InsertRequestSent(GlomoNetworkLar1 *lar1, NODE_ADDR destAddr);//// FUNCTION NetworkLar1RemoveRequestSent()// PURPOSE Remove destination address for locally generated// LAR Request Packet from cache (Reply received)// PARAMETERS destAddr - destination address//void NetworkLar1RemoveRequestSent(GlomoNetworkLar1 *lar1, NODE_ADDR destAddr);//// FUNCTION NetworkLar1LookupRequestSeen()// PURPOSE Return TRUE if the (source addr, seq num) appears in cache// PARAMETERS sourceAddr - source of LAR Request Packet// seqNum - sequence number of LAR Request Packet//BOOL NetworkLar1LookupRequestSeen(LAR1_RequestSeenEntry *reqSeen, NODE_ADDR sourceAddr, int seqNum);//// FUNCTION NetworkLar1PropagateRouteRequest()// PURPOSE Propagate a received LAR Route Request Packet// PARAMETERS oldMsg - the received LAR Route Request Packet//void NetworkLar1PropagateRouteRequest(GlomoNode *node, Message *oldMsg);//// FUNCTION NetworkLar1InitiateRouteRequest()// PURPOSE Initiate a new LAR Route Request Packet// PARAMETERS destAddr - the destination for which route is needed//void NetworkLar1InitiateRouteRequest(GlomoNode *node, NODE_ADDR destAddr);//// FUNCTION NetworkLar1CalculateReqZone()// PURPOSE Calculate and set the request zone in a LAR Request Packet// for a given destination// PARAMETERS msg - the LAR Request Packet to be sent// destAddr - the destination for which route is needed//BOOL NetworkLar1CalculateReqZone(GlomoNode *node, Message *msg, NODE_ADDR destAddr);//// FUNCTION NetworkLar1BufferPacket()// PURPOSE Place packet into send buffer, awaiting valid path// and return TRUE if buffering is successful// PARAMETERS msg - the data packet to be buffered// destAddr - the destination of this data packet//BOOL NetworkLar1BufferPacket(GlomoNode *node, Message *msg, NODE_ADDR destAddr);//// FUNCTION NetworkLar1PendingRouteReq()// PURPOSE Return TRUE if this node has sent a LAR Route Request Packet// for the given destination.// PARAMETERS destAddr - the destination to check//BOOL NetworkLar1PendingRouteReq(GlomoNode *node, NODE_ADDR destAddr);//// FUNCTION NetworkLar1RouteExists()// PURPOSE Return TRUE if this node has a valid route to the destination// PARAMETERS destAddr - the destination to check//BOOL NetworkLar1RouteExists(LAR1_RouteCacheEntry *cacheEntry, NODE_ADDR destAddr);//// FUNCTION NetworkLar1RetrieveCacheEntry()// PURPOSE Return the Route Cache Entry for the given destination if// one exists.// PARAMETERS cacheEntry - the head pointer of the route cache// destAddr - the destination to check//LAR1_RouteCacheEntry *NetworkLar1RetrieveCacheEntry( LAR1_RouteCacheEntry *cacheEntry, NODE_ADDR destAddr);//// FUNCTION NetworkLar1InsertRoute()// PURPOSE Extract route information from a LAR Route Reply Packet// and insert info into the Route Cache.// PARAMETERS pkt - the LAR Route Reply packet// path - the path given in the route reply// numEntries - the number of entries in the path array//void NetworkLar1InsertRoute(GlomoNetworkLar1 *lar1, LAR1_RouteReply *pkt, NODE_ADDR *path, int numEntries);//// FUNCTION NetworkLar1SetTimer()// PURPOSE Set a timer to expire just in case a route reply is not// received in the allotted time.// PARAMETERS eventType - the event that is triggered by the timer// destAddr - the destination node that the timer is// interested in// delay - the delay between now and timer expiration//void NetworkLar1SetTimer(GlomoNode *node, long eventType, NODE_ADDR destAddr, clocktype delay);//// FUNCTION NetworkLar1RouterFunction()// PURPOSE Determine the routing action to take for a the given data// packet, and set the PacketWasRouted variable to TRUE if no// further handling of this packet by IP is necessary.// PARAMETERS msg - the data packet// destAddr - the destination node of this data packet// PacketWasRouted - variable that indicates to IP that it// no longer needs to act on this data packet///* The Following must match RouterFunctionType defined in nwip.h */void NetworkLar1RouterFunction(GlomoNode* node, Message* msg, NODE_ADDR destAddr, BOOL *PacketWasRouted);//// FUNCTION NetworkLar1FreeCacheEntry()// PURPOSE Free the memory used by a route rache entry// PARAMETERS cacheEntry - the entry to free//void NetworkLar1FreeCacheEntry(LAR1_RouteCacheEntry *cacheEntry);//// FUNCTION NetworkLar1InvalidateRoutesThroughBrokenLink()// PURPOSE Mark as unusable routes in the cache which contain the// given node pair// PARAMETERS fromHop - the first node in the node pair// toHop - the receiving node of the node pair//void NetworkLar1InvalidateRoutesThroughBrokenLink( GlomoNode *node, NODE_ADDR fromHop, NODE_ADDR toHop);//// FUNCTION NetworkLar1DeleteRoute()// PURPOSE Remove route to the given destination from the route cache// PARAMETERS destAddr - the given destination//void NetworkLar1DeleteRoute( GlomoNode *node, NODE_ADDR destAddr);//// FUNCTION NetworkLar1TransmitErrorPacket()// PURPOSE Given a packet which MAC 802.11 was unable to transmit to// the neighbor node listed in the source route, this function// will transmit to the data packet's source node, a LAR// Route Error indicating that the route is broken at this link.// PARAMETERS oldMsg - the data packet// nextHop - the nextHop to which the data packet should// have gone//void NetworkLar1TransmitErrorPacket(GlomoNode *node, const Message *oldMsg, NODE_ADDR nextHop);//// FUNCTION NetworkLar1HandleBrokenLink()// PURPOSE Handle message from MAC 802.11 regarding broken link// PARAMETERS msg - the packet returned by MAC 802.11//void NetworkLar1HandleBrokenLink(GlomoNode *node, const Message *msg);//// FUNCTION NetworkLar1PacketDropNotificationHandler()// PURPOSE Handle internal messages from MAC Layer// PARAMETERS msg - the packet returned by MAC//void NetworkLar1PacketDropNotificationHandler( GlomoNode *node, const Message* msg, const NODE_ADDR nextHopAddress);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -