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

📄 nwlar1.h

📁 无线网络仿真工具Glomosim2.03
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * GloMoSim is COPYRIGHTED software.  Release 2.02 of GloMoSim is available  * at no cost to educational users only. * * Commercial use of this software requires a separate license.  No cost, * evaluation licenses are available for such purposes; please contact * info@scalable-networks.com * * By obtaining copies of this and any other files that comprise GloMoSim2.02, * you, the Licensee, agree to abide by the following conditions and * understandings with respect to the copyrighted software: * * 1.Permission to use, copy, and modify this software and its documentation *   for education and non-commercial research purposes only is hereby granted *   to Licensee, provided that the copyright notice, the original author's *   names and unit identification, and this permission notice appear on all *   such copies, and that no charge be made for such copies. Any entity *   desiring permission to use this software for any commercial or *   non-educational research purposes should contact:  * *   Professor Rajive Bagrodia  *   University of California, Los Angeles  *   Department of Computer Science  *   Box 951596  *   3532 Boelter Hall  *   Los Angeles, CA 90095-1596  *   rajive@cs.ucla.edu * * 2.NO REPRESENTATIONS ARE MADE ABOUT THE SUITABILITY OF THE SOFTWARE FOR ANY *   PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. * * 3.Neither the software developers, the Parallel Computing Lab, UCLA, or any *   affiliate of the UC system shall be liable for any damages suffered by *   Licensee from the use of this software. */// Use the latest version of Parsec if this line causes a compiler error.#ifndef LAR1_H#define LAR1_H#include "ip.h"#include "nwcommon.h"#include "main.h"#define LAR1_RREQ_JITTER           10 * MILLI_SECOND#define LAR1_REQ_TIMEOUT           2 * SECOND#define LAR1_SEND_BUFFER_SIZE      128#define LAR1_MAX_ROUTE_LENGTH      9#define LAR1_MAX_SEQ_NUM           1024#define LAR1_REQUEST_SEEN_LIFETIME 30 * SECONDtypedef enum {    LAR1_ROUTE_REQUEST,    LAR1_ROUTE_REPLY,    LAR1_ROUTE_ERROR} LAR1_PacketType;typedef struct lar1_location {    long x;    long y;} LAR1_Location;typedef struct lar1_rcentry {    NODE_ADDR destAddr;    BOOL inUse;    BOOL valid;    double destVelocity;    NODE_ADDR *path;    int pathLength;    clocktype locationTimestamp;    LAR1_Location destLocation;    struct lar1_rcentry *next;} LAR1_RouteCacheEntry;typedef struct lar1_reqseenentry {    NODE_ADDR sourceAddr;    int seqNum;    clocktype lifetime;    struct lar1_reqseenentry *next;} LAR1_RequestSeenEntry;typedef struct lar1_reqsententry {    NODE_ADDR destAddr;    struct lar1_reqsententry *next;} LAR1_RequestSentEntry;typedef struct lar1_sendbufferentry {    NODE_ADDR destAddr;    Message *msg;    BOOL reTx;    clocktype times;} LAR1_SendBufferEntry;typedef struct lar1_zone {    LAR1_Location bottomLeft;    LAR1_Location topLeft;    LAR1_Location topRight;    LAR1_Location bottomRight;} LAR1_Zone;typedef struct lar1_routerequest {    LAR1_PacketType packetType;    NODE_ADDR sourceAddr;    NODE_ADDR destAddr;    BOOL flooding;    int currentHop;    int seqNum;    LAR1_Zone requestZone;} LAR1_RouteRequest;typedef struct lar1_routereply {    LAR1_PacketType packetType;    NODE_ADDR sourceAddr;    NODE_ADDR destAddr;    int segmentLeft;    double destVelocity;    clocktype locationTimestamp;    LAR1_Location destLocation;} LAR1_RouteReply;typedef struct lar1_routeerror {    LAR1_PacketType packetType;    NODE_ADDR sourceAddr;    NODE_ADDR destAddr;    NODE_ADDR fromHop;    NODE_ADDR nextHop;    int segmentLeft;} LAR1_RouteError;typedef struct glomo_network_lar1 {    LAR1_RouteCacheEntry *routeCacheHead;    LAR1_RequestSeenEntry *reqSeenHead;    LAR1_RequestSentEntry *reqSentHead;    LAR1_SendBufferEntry *sendBuf[LAR1_SEND_BUFFER_SIZE];    int sendBufHead,        sendBufTail;    int seqNum;    long DataPacketsSentAsSource,         DataPacketsRelayed,         RouteRequestsSentAsSource,         RouteRepliesSentAsRecvr,         RouteErrorsSentAsErrorSource,         RouteRequestsRelayed,         RouteRepliesRelayed,         RouteErrorsRelayed;    BOOL statsCollected;} GlomoNetworkLar1;//// FUNCTION     NetworkLar1Init()// PURPOSE      Initialize LAR1 Routing Protocol Dataspace// PARAMETERS   lar1            - pointer for dataspace//              nodeInput//void NetworkLar1Init(   GlomoNode* node,    GlomoNetworkLar1** lar1,   const GlomoNodeInput* nodeInput);   //// FUNCTION     NetworkLar1Finalize()// PURPOSE      Finalize statistics Collection//void NetworkLar1Finalize(GlomoNode *node);//// FUNCTION     NetworkLar1HandleProtocolPacket()// PURPOSE      Process a LAR1 generated control packet// PARAMETERS   msg             - The packet//void NetworkLar1HandleProtocolPacket(GlomoNode* node, Message* msg);//// FUNCTION     NetworkLar1HandleCheckTimeoutAlarm()// PURPOSE      Process timeouts sent by LAR1 to itself// PARAMETERS   msg             - the timer//void NetworkLar1HandleCheckTimeoutAlarm(GlomoNode* node, Message* msg);//// FUNCTION     NetworkLar1NodeInZone()// PURPOSE      Returns TRUE if node is within the zone coordinates// PARAMETERS   zone            - structure containing corner coordinates//BOOL NetworkLar1NodeInZone(GlomoNode *node, LAR1_Zone *zone);//// FUNCTION     NetworkLar1HandleRouteErrorPacket()// PURPOSE      Handle received LAR1 Route Error control packets// PARAMETERS   msg             - the control packet//void NetworkLar1HandleRouteErrorPacket(GlomoNode *node, Message *msg);//// FUNCTION     NetworkLar1HandleRouteReply()// PURPOSE      Handle received LAR1 Route Reply control packets// PARAMETERS   msg             - the control packet//void NetworkLar1HandleRouteReply(GlomoNode *node, Message *msg);//// FUNCTION     NetworkLar1TransmitData()// PURPOSE      Retrieve route from route cache, transmit data packet// PARAMETERS   outMsg          - the packet to be sent//void NetworkLar1TransmitData(GlomoNode *node, Message *outMsg);//// FUNCTION     NetworkLar1RetrieveSendBuf()// PURPOSE      Retrieve next data packet for transmission for specified//              destination// PARAMETERS   destAddr        - destination node//Message *NetworkLar1RetrieveSendBuf(GlomoNetworkLar1 *lar1,                                    NODE_ADDR destAddr);//// FUNCTION     NetworkLar1HandleRouteRequest()// PURPOSE      Determine course of action for LAR RREQ packet// PARAMETERS   msg     - the packet//void NetworkLar1HandleRouteRequest(GlomoNode *node, Message *msg);//// FUNCTION     NetworkLar1InitiateRouteReply()// PURPOSE      Create and transmit LAR Route Reply packet// PARAMETERS   oldMsg     - the original LAR Route Request packet//void NetworkLar1InitiateRouteReply(GlomoNode *node, Message *oldMsg);

⌨️ 快捷键说明

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