Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

requesttable.h

Go to the documentation of this file.
00001 // Copyright (c) 2000 by the University of Southern California
00002 // All rights reserved.
00003 //
00004 // Permission to use, copy, modify, and distribute this software and its
00005 // documentation in source and binary forms for non-commercial purposes
00006 // and without fee is hereby granted, provided that the above copyright
00007 // notice appear in all copies and that both the copyright notice and
00008 // this permission notice appear in supporting documentation. and that
00009 // any documentation, advertising materials, and other materials related
00010 // to such distribution and use acknowledge that the software was
00011 // developed by the University of Southern California, Information
00012 // Sciences Institute.  The name of the University may not be used to
00013 // endorse or promote products derived from this software without
00014 // specific prior written permission.
00015 //
00016 // THE UNIVERSITY OF SOUTHERN CALIFORNIA makes no representations about
00017 // the suitability of this software for any purpose.  THIS SOFTWARE IS
00018 // PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
00019 // INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
00020 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00021 //
00022 // Other copyrights might apply to parts of this software and are so
00023 // noted when applicable.
00024 //
00025 // Ported from CMU/Monarch's code, appropriate copyright applies.  
00026 
00027 /* -*- c++ -*-
00028    requesttable.h
00029 
00030    implement a table to keep track of the most current request
00031    number we've heard from a node in terms of that node's id
00032 
00033    implemented as a circular buffer
00034 
00035 */
00036 
00037 #ifndef _requesttable_h
00038 #define _requesttable_h
00039 
00040 #include "path.h"
00041 
00042 struct Entry;
00043 
00044 enum LastType { LIMIT0, UNLIMIT};
00045 
00046 class RequestTable {
00047 public:
00048   RequestTable(int size = 30);
00049   ~RequestTable();
00050   void insert(const ID& net_id, int req_num);
00051   void insert(const ID& net_id, const ID& MAC_id, int req_num);
00052   int get(const ID& id) const;
00053   // rtns 0 if id not found
00054   Entry* getEntry(const ID& id);  
00055 private:
00056   Entry *table;
00057   int size;
00058   int ptr;
00059   int find(const ID& net_id, const ID& MAC_id ) const;
00060 };
00061 
00062 struct Entry {
00063   ID MAC_id;
00064   ID net_id;
00065   int req_num;
00066   Time last_arp;
00067   int rt_reqs_outstanding;
00068   Time last_rt_req;
00069   LastType last_type;
00070 };
00071 
00072 #endif //_requesttable_h

Generated on Tue Apr 20 12:14:29 2004 for NS2.26SourcesOriginal by doxygen 1.3.3