00001 /* -*- c++ -*- 00002 $Id: rtqueue.h,v 1.4 2001/08/15 18:35:00 kclan Exp $ 00003 */ 00004 00005 #ifndef __ifqueue_h__ 00006 #define __ifqueue_h__ 00007 00008 #include <packet.h> 00009 #include <agent.h> 00010 00011 /* 00012 * The maximum number of packets that we allow a routing protocol to buffer. 00013 */ 00014 #define RTQ_MAX_LEN 64 // packets 00015 00016 /* 00017 * The maximum period of time that a routing protocol is allowed to buffer 00018 * a packet for. 00019 */ 00020 #define RTQ_TIMEOUT 30 // seconds 00021 00022 class rtqueue : public Connector { 00023 public: 00024 rtqueue(); 00025 00026 void recv(Packet *, Handler*) { abort(); } 00027 00028 void enque(Packet *p); 00029 00030 inline int command(int argc, const char * const* argv) 00031 { return Connector::command(argc, argv); } 00032 00033 /* 00034 * Returns a packet from the head of the queue. 00035 */ 00036 Packet* deque(void); 00037 00038 /* 00039 * Returns a packet for destination "D". 00040 */ 00041 Packet* deque(nsaddr_t dst); 00042 /* 00043 * Finds whether a packet with destination dst exists in the queue 00044 */ 00045 char find(nsaddr_t dst); 00046 00047 private: 00048 Packet* remove_head(); 00049 void purge(void); 00050 void findPacketWithDst(nsaddr_t dst, Packet*& p, Packet*& prev); 00051 void verifyQueue(void); 00052 00053 Packet *head_; 00054 Packet *tail_; 00055 00056 int len_; 00057 00058 int limit_; 00059 double timeout_; 00060 00061 }; 00062 00063 #endif /* __ifqueue_h__ */
1.4.6