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

📄 sentstore.hh

📁 COPE the first practical network coding scheme which is developped on click
💻 HH
字号:
#ifndef SENTSTORE_HH#define SENTSTORE_HHCLICK_DECLS/* * =c * SentStore () * =s Wifi, Wireless Routing * stores transmitted packets and decodes received packets * =d * It's a collection of storage, one per neighbour and two-hop neighbour, * they are managed slightly differently but with overlaps * packets are mostly meant for decoding, but some would be used for retransmission *  * Input 0: packets forwarded by the router -> clone and add to the appropriate queue * Output 0: push the original packet downstream */#include<click/element.hh>//#include<elements/standard/simplequeue.hh>#include<click/bighashmap.hh>#include<click/timer.hh>#include<click/packet.hh>#include <click/ipaddress.hh>#include <click/string.hh>class SentStore : public Element { public:    SentStore();		  ~SentStore();		    const char *class_name() const	{ return "SentStore"; }  const char *processing() const	{ return PUSH;}  void *cast(const char *);  int configure(Vector<String> &conf, ErrorHandler *);  int initialize(ErrorHandler *);  void run_timer();  void add_handlers();  static String stats(Element *, void *);  static int static_clear(const String &arg, Element *e,                          void *, ErrorHandler *errh);  void push(int port, Packet *);  //Packet* pull(int port);  Packet* getPacket(uint32_t, uint16_t);  //void add_await_ack_entry(uint32_t, uint32_t, uint32_t);       //void process_ack();               // *****signature list incomplete   void reset();  // for statistics  int _added;                       // how many packets have been added to the storage  int _removed;                     // how many packets have been removed from the storage  int _expired;                     // packets removed due to timeout  int _unacked;                     // number of packets awaiting acks  int _retxed;                      // number of packets retransmitted (inc. retx of the same packets)  class PacketEntry { public:    // these are keys for the two levels of hashmaps in _queues below    //uint32_t _nb;   // the ip address of the next-hop or two-hop neighbour    uint32_t _src;   // the src ip address of the packet    uint16_t _seq;  // the seq number of the corresponding packet    PacketEntry (uint32_t src, uint16_t seq) : _src(src), _seq(seq) {}  }; private:  // ip address  //IPAddress _ip;  // -- for storage  // key is "src IP" + "packet seq number", value is a point to the packet   typedef HashMap<String, Packet*> TxStore;//Per2hopNbQ;   // key is two-hop neighbour's IPaddress, value is the transmitted queue for it  //typedef HashMap<IPAddress, Per2hopNbQ*> TxQueues;    TxStore _storage;   // note: since ack is added to encoded packets, the queues above will also hold   // packets that do not have a next2hop, so again the names might be misleading  // the structures are the same though.  // ----------------  // -- for ack/retransmit  // sometimes it's necessary to reference the above packets according to the next hop  // so a similar structure to hold PacketEntry info  // key is "src IP" + "packet seq number", value is a point to the PacketEntry   // so that we can reference the packet eventually  typedef HashMap<String, PacketEntry*> NbEntries;  // key is next hop IPaddress, value is the nb entries  typedef HashMap<IPAddress, NbEntries*> AckEntries;  AckEntries _await_acks;  // ----------------  // a vector of vectors to keep track of packets to be expunged  // the size of the top-level vector is the timeout  //Vector<Packet*> _decoded_packets;  // -- for packet removal  // timeout to expunge packets, in milliseconds  int _timeout;  // granularity of timeouts, in milliseconds  int _granularity;  typedef Vector<PacketEntry*> PerUnitEntries;  // a vector of vectors to keep track of which packets were received at what time  // the index of the top level vector indicates how many 'units' (50 millisecond for now)  // have passed since the start of the record  Vector<PerUnitEntries*> _removal_entries;  // the time the earliest packets were stored   int _start_time;  Timer _timer;  void clear_entries(PerUnitEntries *);};CLICK_ENDDECLS#endif

⌨️ 快捷键说明

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