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

📄 insignia.h

📁 INSIGNIA是专门为无线ad hoc网络设计的qos信令协议
💻 H
字号:
/* * File : insignia.h *        header file for a INSIGNIA agent class * * Author : Gahng-Seop Ahn (ahngang@comet.columbia.edu), *          INSIGNIA Project (insignia@comet.columbia.edu) * * Modified : May 9, 2000 * */#ifndef ns_insignia_h#define ns_insignia_h#include "agent.h"#include "packet.h"#include "ip.h"#include "mac.h"#include "mac-802_11.h"#include "priqueue.h"#include "dsr/dsragent.h"#define RU      1     // msg_type : reservation update#define BM      0     // msg_type : bandwidth monitor (end to end)#define BE      0     // srv_mode & tos_ : best effort packet#define RES     1     // srv_mode & tos_ : reserved packet#define RPT     2     // tos_   : QOS report packet#define BQ      0     // pl_ind : base QoS#define EQ      1     // pl_ind : enhanced QoS#define INS_BW          256   /* available bandwidth for insignia */#define RPT_PRD           2   /* QoS report period */#define PTIMER            2   /* timer for print_stat */#define BACKOFF          10   /* backoff time at src */#define BTIMER            1   /* bandwidth monitor timer */#define ETIMER            7   /* end to end timer */#define HTIMER            5   /* hop by hop timer */#define H_FACTOR         30/* *  htimer will be assigned dynamically from every update. *  For example, *  htimer = (htimer + (ctime - htime) * H_FACTOR) / 2; */struct hdr_insignia{  u_short msg_type:1;     // message type (RU/BM)  u_short srv_mode:1;     // service mode (RES/BE)   u_short pl_ind:1;       // payload indicator (BQ/EQ)  u_short reserved:5;     // reserved for later use  u_short bw_ind:8;       // bandwidth indicator (MAX/MIN)  u_short min_bw:8;       // minimum bandwidth request  u_short max_bw:8;       // maximum bandwidth request  float   src_time;       // to measure the end to end delay};typedef struct rsvcache{  u_short   msg_type:1;   // next message type (RU/BE)  u_short   backoff:2;    // active(0) or backoff(1/2)  u_short   reserved:6;   // reserved for later use  u_short   bw_ind:8;     // insignia bandwidth indicator  u_short   bw_mon:8;     // insignia bandwidth monitor (end to end)  u_short   scu_cnt:4;    // scale up counter  u_short   scd_cnt:4;    // scale down counter  u_short   rpt_seq;      // QOS report pkt sequence number  float     etime;        // time stamp for QoS Report  float     htime;        // time stamp for packet  float     htimer;       // hop by hop timer  nsaddr_t  src_;         // source address  nsaddr_t  dst_;         // destination address  u_int16_t sport_;       // source port number  u_int16_t dport_;       // destination port number  struct rsvcache *next_; // linked list pointer};typedef struct bwmcache{  u_short   bw_ind;       // reserved bandwidth  float     btime;        // time stamp for bw monitor  u_int32_t mac_src;      // source mac address  nsaddr_t  src_;         // source address  nsaddr_t  dst_;         // destination address  u_int16_t sport_;       // source port number  u_int16_t dport_;       // destination port number   struct bwmcache *next_; // linked list pointer};typedef struct flowspec{  nsaddr_t  src_, dst_;  u_int16_t sport_, dport_;  u_short   min_bw, max_bw;  u_short   bqos, eqos;  u_short   granulity;  u_short   adpt_pr;  int       payload1, payload2;  int s_bqres, s_bqbe, s_eqres, s_eqbe;  int r_bqres, r_bqbe, r_eqres, r_eqbe;  float delay, res_delay, be_delay;  float mindelay, res_mindelay, be_mindelay;  float maxdelay, res_maxdelay, be_maxdelay;};class INSIGNIA : public Agent, public Tap { public:  INSIGNIA();  int command(int argc, const char*const* argv);  void recv(Packet*, Handler*);  void tap(const Packet*);  // tap out all data packets received at this host and   // promiscously snoop them for bandwidth monitoring protected:  int       off_insignia_;      // offset for insignia header  int       off_ip_;            // offset for ip header  int       off_cmn_;           // offset for common header  int       off_mac_;           // offset for mac header  nsaddr_t  net_id;             // ip address of current mobile  u_short   mac_id;             // mac address of current mobile  NsObject  *target_;           // forward packet to next agent  Tap       *tap_;              // forward tap to dsragent  PriQueue  *ifq;               // interface queue  int       ins_sum;            // insignia summary ON/OFF  int       ins_tr;             // insignia trace   ON/OFF  char      ins_dir[64];        // insignia trace directory  FILE      *fp;                // insignia trace file pointer  rsvcache  *rsv_tail;          // pointer for reservation cache  bwmcache  *bwm_tail;          // pointer for local bandwidth monitor cache  flowspec  *port[10];          // pointer for flow specification  float     ctime;              // current time  int       this_bw;            // bandwidth reserved by this node  int       neighbor_bw;        // bandwidth reserved by neighbor node  void      terminate();  void      insigniaSRC(Packet *pkt);  void      insigniaDST(Packet *pkt, Handler *h);  void      insigniaHOP(Packet *pkt);  void      adaptation(Packet *pkt, rsvcache *rsv_cache);  rsvcache  *admt_ctrl(Packet *pkt, rsvcache *rsv_cache);  rsvcache  *lookup_rsvcache(Packet *pkt);  void      prune_rsvcache();  int       expire_rsvcache(rsvcache *rsv_cache);  void      send_QOSreport(Packet *pkt, Handler *h);  void      recv_QOSreport(Packet *pkt);  void      local_bw_monitor(Packet *pkt);  void      measureSRC(Packet *pkt);  void      measureDST(Packet *pkt);  void      fprint_pkt(Packet *pkt);  void      fprint_cache(rsvcache *rsv_cache);  void      fprint_sum(int i);};#endif

⌨️ 快捷键说明

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