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

ls.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 //  Copyright (C) 1998 by Mingzhou Sun. All rights reserved.
00026 //  This software is developed at Rensselaer Polytechnic Institute under 
00027 //  DARPA grant No. F30602-97-C-0274
00028 //  Redistribution and use in source and binary forms are permitted
00029 //  provided that the above copyright notice and this paragraph are
00030 //  duplicated in all such forms and that any documentation, advertising
00031 //  materials, and other materials related to such distribution and use
00032 //  acknowledge that the software was developed by Mingzhou Sun at the
00033 //  Rensselaer  Polytechnic Institute.  The name of the University may not 
00034 //  be used to endorse or promote products derived from this software 
00035 //  without specific prior written permission.
00036 //
00037 // $Header: /nfs/jade/vint/CVSROOT/ns-2/linkstate/ls.h,v 1.5 2002/10/09 03:47:00 difa Exp $
00038 
00039 #ifndef ns_ls_h
00040 #define ns_ls_h
00041 
00042 #include <sys/types.h> 
00043 #include <list>
00044 #include <map>
00045 #include <utility>
00046 
00047 #include "timer-handler.h"
00048 
00049 const int LS_INVALID_COUNT = -1;
00050 const int LS_INIT_ACCESS_COUNT = 3;
00051 const int LS_INVALID_NODE_ID = 65535;
00052 const int LS_INVALID_COST = 65535;
00053 const int LS_MIN_COST = 0;
00054 const int LS_MAX_COST = 65534;
00055 const int LS_MESSAGE_CENTER_SIZE_FACTOR = 4; // times the number of nodes 
00056 const int LS_DEFAULT_MESSAGE_SIZE = 100; // in bytes
00057 const int LS_LSA_MESSAGE_SIZE = 100; // in bytes
00058 const double LS_RTX_TIMEOUT = 0.002;  // default to 2ms to begin with
00059 const int LS_TIMEOUT_FACTOR = 3;   // x times of one-way total delay
00060 // Topo message is not too long due to incremental update
00061 const int LS_TOPO_MESSAGE_SIZE = 200; // in bytes
00062 const int LS_ACK_MESSAGE_SIZE = 20; // in bytes
00063 const unsigned int LS_INVALID_MESSAGE_ID = 0;
00064 const unsigned int LS_BIG_NUMBER = 1048576;
00065 const unsigned int LS_WRAPAROUND_THRESHOLD = 1073741824; // 2^30
00066 const unsigned int LS_MESSAGE_TYPES = 6;
00067 
00068 enum ls_status_t { 
00069         LS_STATUS_DOWN = 0, 
00070         LS_STATUS_UP = 1
00071 };
00072 
00073 enum ls_message_type_t { 
00074         LS_MSG_INVALID = 0, 
00075         LS_MSG_LSA = 1,         // Link state advertisement
00076         LS_MSG_TPM = 2,         // Topology map message
00077         LS_MSG_LSAACK = 3,      // Link state advertisement ACK
00078         LS_MSG_TPMACK = 4, 
00079         LS_MSG_LSM = 5, 
00080 };
00081 
00082 template <class _Tp>
00083 class LsList : public list<_Tp> {
00084 public:
00085         typedef list<_Tp> baseList;
00086         LsList() : baseList() {}
00087         LsList(const _Tp& x) : baseList(1, x) {}
00088         void eraseAll() { 
00089                 baseList::erase(begin(), end()); 
00090         }
00091         LsList<_Tp>& operator= (const LsList<_Tp> & x) {
00092                 return (LsList<_Tp> &)baseList::operator= (x);
00093         }
00094 };
00095 
00096 template<class Key, class T>
00097 class LsMap : public map<Key, T, less<Key> > {
00098 public:
00099         typedef less<Key> less_key;
00100         typedef map<Key, T, less_key> baseMap;
00101         LsMap() : baseMap() {}
00102 
00103         // this next typedef of iterator seems extraneous but is required by gcc-2.96
00104         typedef typename map<Key, T, less<Key> >::iterator iterator;
00105         typedef pair<iterator, bool> pair_iterator_bool;
00106         iterator insert(const Key & key, const T & item) {
00107                 typename baseMap::value_type v(key, item);
00108                 pair_iterator_bool ib = baseMap::insert(v);
00109                 return ib.second ? ib.first : baseMap::end();
00110         }
00111 
00112         void eraseAll() { erase(begin(), end()); }
00113         T* findPtr(Key key) {
00114                 iterator it = baseMap::find(key);
00115                 return (it == baseMap::end()) ? (T *)NULL : &((*it).second);
00116         }
00117 };
00118 
00119 /*
00120   LsNodeIdList -- A list of int 's. It manages its own memory
00121 */
00122 class LsNodeIdList : public LsList<int> {
00123 public:
00124         int appendUnique (const LsNodeIdList& x);
00125 };  
00126 
00127 /* -------------------------------------------------------------------*/
00128 /* 
00129    LsLinkState -- representing a link, contains neighborId, cost and status
00130 */
00131 struct LsLinkState {
00132         // public data
00133         int neighborId_;  
00134         ls_status_t status_;
00135         int cost_;
00136         u_int32_t sequenceNumber_;  
00137 
00138         // public methods
00139         LsLinkState() : neighborId_(LS_INVALID_NODE_ID),
00140                 status_(LS_STATUS_DOWN), cost_(LS_INVALID_COST) {}
00141         LsLinkState(int id, ls_status_t s, int c) : neighborId_(id), 
00142                 status_(s), cost_(c) {}
00143 
00144         void init (int nbId, ls_status_t s, int c){
00145                 neighborId_ = nbId;
00146                 status_ = s;
00147                 cost_ =c;
00148         }
00149 } ;
00150 
00151 /* 
00152    LsLinkStateList 
00153 */
00154 typedef LsList<LsLinkState> LsLinkStateList;
00155 
00156 /* -------------------------------------------------------------------*/
00157 /*
00158   LsTopoMap
00159   the Link State Database, the representation of the
00160   topology within the protocol 
00161 */
00162 typedef LsMap<int, LsLinkStateList> LsLinkStateListMap;
00163 
00164 class LsTopoMap : public LsLinkStateListMap {
00165 public:
00166         // constructor / destructor 
00167         // the default ones 
00168         LsTopoMap() : LsLinkStateListMap() {}
00169   
00170         //   // map oeration
00171         //   iterator begin() { return LsLinkStateListMap::begin();}
00172         //   iterator end() { return LsLinkStateListMap::end();}
00173         //  iterator begin() { return baseMap::begin();}
00174         //   const_iterator begin() const { return  baseMap::begin();}
00175         //   iterator end() { return baseMap::end();}
00176         //   const_iterator end() const { return baseMap::end();}
00177 
00178         // insert one link state each time 
00179         LsLinkStateList* insertLinkState(int nodeId, 
00180                                          const LsLinkState& linkState);
00181         // update returns true if there's change
00182         bool update(int nodeId, const LsLinkStateList& linkStateList);
00183         //   friend ostream & operator << ( ostream & os, LsTopoMap & x) ;
00184         void setNodeId(int id) { myNodeId_ = id ;}
00185 private:
00186         int myNodeId_; // for update()
00187 };
00188 
00189 typedef LsTopoMap LsTopology;
00190 typedef LsTopoMap* LsTopoMapPtr;
00191 
00192 /*
00193   LsPath - A struct with destination, cost, nextHop
00194 */
00195 struct LsPath {
00196         LsPath() : destination (LS_INVALID_NODE_ID) {}
00197         LsPath(int dest, int c, int nh)
00198                 : destination (dest), cost(c), nextHop(nh) {}
00199         // methods
00200         bool isValid() { 
00201                 return ((destination != LS_INVALID_NODE_ID) && 
00202                         (cost != LS_INVALID_COST) && 
00203                         (nextHop != LS_INVALID_COST));
00204         }
00205 
00206         // public data
00207         int destination;
00208         int cost;
00209         int nextHop;
00210 };
00211 
00212 /*
00213   LsEqualPaths -- A struct with one cost and a list of multiple next hops
00214   Used by LsPaths
00215 */
00216 struct LsEqualPaths {
00217 public:
00218         int  cost;
00219         LsNodeIdList nextHopList;
00220 
00221         // constructors
00222         LsEqualPaths() : cost(LS_INVALID_COST) {}
00223         LsEqualPaths(int c, int nh) : cost(c), nextHopList() {
00224                 nextHopList.push_back(nh);
00225         }
00226         LsEqualPaths(const LsPath & path) : cost (path.cost), nextHopList() {
00227                 nextHopList.push_back(path.nextHop);
00228         }
00229         LsEqualPaths(int c, const LsNodeIdList & nhList) 
00230                 : cost(c), nextHopList(nhList) {}
00231   
00232         LsEqualPaths& operator = (const LsEqualPaths & x ) {
00233                 cost = x.cost;
00234                 nextHopList = x.nextHopList;
00235                 return *this;
00236         }
00237 
00238         // copy 
00239         LsEqualPaths& copy(const LsEqualPaths & x) { return operator = (x) ;}
00240 
00241         // appendNextHopList 
00242         int appendNextHopList(const LsNodeIdList & nhl) {
00243                 return nextHopList.appendUnique (nhl);
00244         }
00245 };
00246 
00247 /* 
00248    LsEqualPathsMap -- A map of LsEqualPaths
00249 */
00250 typedef LsMap< int, LsEqualPaths > LsEqualPathsMap;
00251 
00252 /*
00253   LsPaths -- enhanced LsEqualPathsMap, used in LsRouting
00254 */
00255 class LsPaths : public LsEqualPathsMap {
00256 public:
00257         LsPaths(): LsEqualPathsMap() {}
00258   
00259         // -- map operations 
00260         iterator begin() { return LsEqualPathsMap::begin();}
00261         iterator end() { return LsEqualPathsMap::end();}
00262 
00263         // -- specical methods that facilitates computeRoutes of LsRouting
00264         // lookupCost
00265         int lookupCost(int destId) {
00266                 LsEqualPaths * pEP = findPtr (destId);
00267                 if ( pEP == NULL ) return LS_MAX_COST + 1;
00268                 // else
00269                 return pEP->cost;
00270         }
00271 
00272         // lookupNextHopListPtr
00273         LsNodeIdList* lookupNextHopListPtr(int destId) {
00274                 LsEqualPaths* pEP = findPtr(destId);
00275                 if (pEP == NULL ) 
00276                         return (LsNodeIdList *) NULL;
00277                 // else
00278                 return &(pEP->nextHopList);
00279         }
00280   
00281         // insertPath without checking validity
00282         iterator insertPathNoChecking(int destId, int cost, int nextHop) {
00283                 LsEqualPaths ep(cost, nextHop);
00284                 iterator itr = insert(destId, ep);
00285                 return itr; // for clarity
00286         }     
00287 
00288         // insertPathNoChekcing()
00289         iterator insertPathNoChecking (const LsPath & path) {
00290                 return insertPathNoChecking(path.destination, path.cost, 
00291                                             path.nextHop);
00292         }
00293         // insertPath(), returns end() if error, else return iterator 
00294         iterator insertPath(int destId, int cost, int nextHop);
00295         iterator insertPath(const LsPath& path) {
00296                 return insertPath(path.destination, path.cost, path.nextHop);
00297         }
00298         // insertNextHopList 
00299         iterator insertNextHopList(int destId, int cost, 
00300                                    const LsNodeIdList& nextHopList);
00301 };
00302 
00303 /*
00304   LsPathsTentative -- Used in LsRouting, remembers min cost and location 
00305 */
00306 class LsPathsTentative : public LsPaths {
00307 public:
00308         LsPathsTentative() : LsPaths(), minCost(LS_MAX_COST+1) {
00309                 minCostIterator = end();
00310         }
00311   
00312         // combining get and remove min path
00313         LsPath popShortestPath();
00314   
00315 private:
00316         int minCost; // remembers the min cost
00317         iterator minCostIterator; // remembers where it's stored
00318         iterator findMinEqualPaths();
00319 };
00320 
00321 /* 
00322    LsMessage 
00323 */
00324 struct LsMessage {
00325         LsMessage() : type_(LS_MSG_INVALID), contentPtr_(NULL) {}
00326         LsMessage(u_int32_t id, int nodeId, ls_message_type_t t) :
00327                 type_(t), messageId_(id),
00328                 sequenceNumber_(id), originNodeId_(nodeId), 
00329                 contentPtr_(NULL) {}
00330         ~LsMessage() {
00331                 if ((type_ == LS_MSG_LSM) && (lslPtr_ != NULL)) {
00332                         delete lslPtr_;
00333                         lslPtr_ = NULL;
00334                 }
00335         }
00336         ls_message_type_t type_;
00337         u_int32_t messageId_;
00338         u_int32_t sequenceNumber_; 
00339         int originNodeId_; 
00340         union {
00341                 LsLinkStateList* lslPtr_;
00342                 const LsTopoMap* topoPtr_;
00343                 void* contentPtr_;
00344         };
00345 };
00346 
00347 // TODO -- not used, comment out
00348 // Some time we just want the header, since the message has a content
00349 // which will be destroyed with it goes out of scope, 
00350 // used by ack manager
00351 struct LsMessageInfo
00352 {
00353         ls_message_type_t type_;
00354         int destId_; 
00355         u_int32_t msgId_;
00356         u_int32_t sequenceNumber_;    
00357         union {
00358                 // for LSA, the originator of the msg
00359                 int originNodeId_;  
00360                 // for LSA_ACK, the originator of the lsa being acked
00361                 int originNodeIdAck_; 
00362         };
00363         // constructor 
00364         LsMessageInfo() {}
00365         LsMessageInfo(int d, const LsMessage& msg ) :
00366                 type_(msg.type_), destId_(d),  msgId_(msg.messageId_),
00367                 sequenceNumber_(msg.sequenceNumber_),
00368                 originNodeId_(msg.originNodeId_)  {}
00369         LsMessageInfo(int d , ls_message_type_t t, int o, 
00370                       u_int32_t seq, u_int32_t mId) :
00371                 type_(t), destId_(d), msgId_(mId), sequenceNumber_(seq), 
00372                 originNodeId_(o) {}
00373 };
00374 
00375 /* 
00376    LsMessageCenter -- Global storage of LsMessage's for retrieval
00377 */
00378 class LsMessageCenter {
00379 public:
00380         typedef LsMap <u_int32_t, LsMessage> baseMap;
00381         // constructor
00382         LsMessageCenter () 
00383                 : current_lsa_id(LS_INVALID_MESSAGE_ID + 1), 
00384                 current_other_id(LS_INVALID_MESSAGE_ID + 2),
00385                 max_size(0), lsa_messages(), other_messages() {}
00386   
00387         void setNodeNumber (int number_of_nodes) {
00388                 max_size = number_of_nodes * LS_MESSAGE_CENTER_SIZE_FACTOR;
00389         }
00390         LsMessage* newMessage (int senderNodeId, ls_message_type_t type);
00391         u_int32_t duplicateMessage( u_int32_t msgId) {
00392                 return msgId;
00393         }
00394         u_int32_t duplicateMessage(const LsMessage& msg) {
00395                 return duplicateMessage(msg.messageId_);
00396         }
00397         bool deleteMessage(u_int32_t msgId) ;
00398         bool deleteMessage (const LsMessage& msg) {
00399                 return deleteMessage(msg.messageId_);
00400         }
00401         LsMessage* retrieveMessagePtr(u_int32_t msgId){
00402                 if (isLSA(msgId)) {
00403                         return lsa_messages.findPtr(msgId);
00404                 } else {
00405                         return other_messages.findPtr(msgId);
00406                 }
00407         }
00408         static LsMessageCenter& instance() { 
00409                 return msgctr_;
00410         }
00411 
00412 private:
00413         static LsMessageCenter msgctr_; // Singleton class
00414 
00415         u_int32_t current_lsa_id ;
00416         u_int32_t current_other_id;
00417         unsigned int max_size; // if size() greater than this number, erase begin().
00418         typedef LsMap <u_int32_t, LsMessage > message_storage;
00419         message_storage lsa_messages;
00420         message_storage other_messages;
00421         void init();
00422         int isLSA (u_int32_t msgId) {
00423                 // to see if msgId's last bit is different from 
00424                 // LS_INVALID_MESSAGE_ID
00425                 return (0x1 & (msgId ^ LS_INVALID_MESSAGE_ID));
00426         }
00427 };
00428 
00429 /* 
00430    LsMessageHistory 
00431 */
00432 typedef LsList<u_int32_t> LsMessageIdList;
00433 typedef less<int> less_node_id;
00434 class LsMessageHistory : public LsMap<int, u_int32_t> {
00435 public:
00436         // isNewMessage, note: it saves this one in the history as well
00437         bool isNewMessage ( const LsMessage & msg ); 
00438 };
00439 
00440 class LsRetransmissionManager;
00441 class LsRetransTimer : public TimerHandler {
00442 public:
00443         LsRetransTimer() {}
00444         LsRetransTimer (LsRetransmissionManager *amp , int nbrId)
00445                 : ackManagerPtr_(amp), neighborId_(nbrId) {}
00446         virtual void expire(Event *e);
00447 protected:
00448         LsRetransmissionManager* ackManagerPtr_;
00449         int neighborId_;
00450 };
00451 
00452 struct LsIdSeq {
00453         u_int32_t msgId_;
00454         u_int32_t seq_;
00455         LsIdSeq() {}
00456         LsIdSeq(u_int32_t id, u_int32_t s) : msgId_(id), seq_(s) {}
00457 };
00458 
00459 /* LsUnackPeer 
00460    used in ackManager to keep record a peer who still haven't ack some of 
00461    its LSA or Topo packets
00462 */
00463 struct LsUnackPeer {
00464         double rtxTimeout_; // time out value 
00465         LsRetransTimer timer_;
00466         u_int32_t tpmSeq_; // topo message Id
00467 
00468         LsMap<int, LsIdSeq> lsaMap_;
00469 
00470         // constructor
00471         LsUnackPeer() : tpmSeq_(LS_INVALID_MESSAGE_ID) {}
00472         LsUnackPeer(LsRetransmissionManager* amp, int nbrId, 
00473                     double timeout = LS_RTX_TIMEOUT) : 
00474                 rtxTimeout_(timeout), timer_(amp, nbrId), 
00475                 tpmSeq_(LS_INVALID_MESSAGE_ID) {}
00476 };
00477 
00478 /* 
00479    LsDelayMap
00480    store the estimated one-way total delay for eay neighbor, in second
00481 */
00482 typedef LsMap< int, double > LsDelayMap; 
00483 
00484 /* 
00485    LsRetransmissionManager -- handles retransmission and acknowledgement
00486 */
00487 class LsRouting; 
00488 class LsRetransmissionManager : public LsMap<int, LsUnackPeer> {
00489 public:
00490         LsRetransmissionManager(LsRouting& lsr) : lsRouting_(lsr) {} 
00491 
00492         void initTimeout(LsDelayMap* delayMapPtr);
00493         void cancelTimer(int neighborId);
00494 
00495         // Called by LsRouting when a message is sent out 
00496         int messageOut(int peerId, const LsMessage& msg);
00497   
00498         // Called by LsRouting when an ack is received
00499         int ackIn(int peerId,  const LsMessage& ack);
00500 
00501         // Called by retransmit timer
00502         int resendMessages(int peerId);
00503 
00504 private:
00505         // data
00506         LsRouting& lsRouting_;
00507 };
00508 
00509 inline void LsRetransTimer::expire(Event *e) 
00510 { 
00511         ackManagerPtr_->resendMessages(neighborId_); 
00512 }
00513    
00514 /* 
00515    LsNode -- represents the node environment interface 
00516    It serves as the interface between the Routing class and the actual 
00517    simulation enviroment 
00518    rtProtoLS will derive from LsNode as well as Agent
00519 */
00520 class LsNode {
00521 public:
00522         virtual bool sendMessage(int destId, u_int32_t msgId, 
00523                                   int msgsz = LS_DEFAULT_MESSAGE_SIZE) = 0;
00524         virtual void receiveMessage(int sender, u_int32_t msgId) = 0;
00525         // TODO , maybe not, use one type of message, that's it. 
00526         // All go to message center.
00527         // sendAck 
00528         // receiveAck
00529         virtual int getNodeId() = 0;
00530         virtual LsLinkStateList* getLinkStateListPtr()= 0; 
00531         virtual LsNodeIdList* getPeerIdListPtr() = 0;
00532         virtual LsDelayMap* getDelayMapPtr() = 0;
00533 };
00534 
00535 /* 
00536    LsRouting -- The implementation of the Link State Routing protocol
00537 */
00538 class LsRouting {
00539 public:
00540         static int msgSizes[ LS_MESSAGE_TYPES ];
00541         friend class LsRetransmissionManager;
00542 
00543         // constructor and distructor
00544         LsRouting() : myNodePtr_(NULL),  myNodeId_(LS_INVALID_NODE_ID), 
00545                 peerIdListPtr_(NULL), linkStateListPtr_(NULL),
00546                 routingTablePtr_(NULL),
00547                 linkStateDatabase_(), lsaHistory_(), ackManager_(*this) {}
00548         ~LsRouting() {
00549                 //delete pLinkStateDatabase;
00550                 if (routingTablePtr_ != NULL)
00551                         delete routingTablePtr_;
00552         }
00553 
00554         bool init(LsNode* nodePtr);
00555         void computeRoutes() {
00556                 if (routingTablePtr_ != NULL)
00557                         delete routingTablePtr_;
00558                 routingTablePtr_ = _computeRoutes();
00559         }
00560         LsEqualPaths* lookup(int destId) {
00561                 return (routingTablePtr_ == NULL) ? 
00562                         (LsEqualPaths *)NULL : 
00563                         routingTablePtr_->findPtr(destId);
00564         }
00565 
00566         // to propogate LSA, all Links, called by node and self
00567         bool sendLinkStates(bool buffer = false); 
00568         void linkStateChanged();
00569         void sendBufferedMessages() ;
00570 
00571         // called by node when messages arrive
00572         bool receiveMessage(int senderId , u_int32_t msgId);
00573 
00574 private:
00575         // most of these pointers should have been references, 
00576         // except routing table
00577         LsNode * myNodePtr_; // where I am residing in
00578         int myNodeId_; // who am I
00579         LsNodeIdList* peerIdListPtr_; // my peers
00580         LsLinkStateList* linkStateListPtr_; // My links
00581         LsMessageCenter* messageCenterPtr_; // points to static messageCenter
00582         LsPaths* routingTablePtr_; // the routing table
00583         LsTopoMap linkStateDatabase_; // topology;
00584         LsMessageHistory lsaHistory_; // Remember what we've seen
00585         LsMessageHistory tpmHistory_; 
00586         LsRetransmissionManager ackManager_; // Handles ack and retransmission
00587 
00588         struct IdMsgPtr {
00589                 int peerId_;
00590                 const LsMessage* msgPtr_;
00591                 IdMsgPtr() {};
00592                 IdMsgPtr(int id, const LsMessage* p) :
00593                         peerId_(id), msgPtr_(p) {}
00594         };
00595         typedef LsList<IdMsgPtr> MessageBuffer;
00596         MessageBuffer messageBuffer_;
00597 
00598 private:
00599         LsMessageCenter& msgctr() { return LsMessageCenter::instance(); }
00600         LsPaths* _computeRoutes();
00601         bool isUp(int neighborId);
00602 
00603         bool receiveAck (int neighborId, LsMessage* msgPtr) {
00604                 ackManager_.ackIn(neighborId, *msgPtr);
00605                 return true;
00606         }
00607         bool receiveLSA (int neighborId, LsMessage* msgPtr);
00608         bool receiveTopo(int neighborId, LsMessage* msgPtr);
00609 
00610         // send the entire topomap
00611         // don't worry, in simulation only the pointer is sent
00612         // in ospf, only the descrpition of it is sent first, 
00613         void sendTopo(int neighborId);
00614         void regenAndSend(int exception, int origin, 
00615                           const LsLinkStateList& lsl);
00616         bool sendAck(int nbrId, ls_message_type_t type, 
00617                      int originNodeIdAcked, u_int32_t originMsgIdAcked);
00618         void resendMessage(int neighborId, u_int32_t msgId, 
00619                             ls_message_type_t type) {
00620                 myNodePtr_->sendMessage(neighborId, msgId, msgSizes[type]);
00621         }
00622         // just store the outgoing messages, and wait for cmd flushBuffer to 
00623         // actually send out 
00624         void bufferedSend (int peerId, const LsMessage* mp) {
00625                 messageBuffer_.push_back(IdMsgPtr(peerId, mp));
00626         }
00627 };
00628 
00629 #endif // ns_ls_h

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