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

📄 rsvp-objects.h

📁 rsvp and wfq patch for Netowrk Simulator 2
💻 H
字号:
/* * Copyright (c) 1998 The University of Bonn * All rights reserved. *  * Permission to use and copy this software in source and binary forms * is hereby granted, provided that the above copyright notice, this * paragraph and the following disclaimer are retained in any copies * of any part of this software and that the University of Bonn is * acknowledged in all documentation pertaining to any such copy * or derivative work. The name of the University of Bonn may not * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,  * EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL  * THE UNIVERSITY OF BONN BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF  * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  * SOFTWARE. */ #ifndef ns_rsvp_objects_h#define ns_rsvp_objects_h#include "config.h"/* The following RSVP objects are currently defined in this implementation:   1 - SESSION   3 - RSVP_HOP   5 - TIME_VALUES   6 - ERROR_SPEC   8 - STYLE   9 - FLOWSPEC   10 - FILTER_SPEC   11 - SENDER_TEMPLATE   12 - SENDER_TSPEC   15 - RESV_CONFIRM   */const int STYLE_FF = 10;const int STYLE_SE = 18;const int STYLE_WF = 17;/* The common header for all RSVP objects */struct objheader {  int length;     // The "simulated" length of the object  int conlength;  // The "real" length of the object contents  int classnum;   // The Class-Num as defined in RFC 2205  int ctype;      // The C-Type as defined in RFC 2205};/* RSVPobject is the base class for all  RSVP objects.   All objects that are derived from this base class will usually have   at least two constructors: One which is used to construct a new   RSVP object and receives the necessary values as arguments, and   one which is used to reconstruct an RSVP object from an RSVP message   that was received. The only argument for the latter is a pointer to   a buffer which contains the contents of the object. The objects   copy the buffer into their local buffer.   */class RSVPobject {public:  RSVPobject() : next(0) {};  virtual ~RSVPobject() { delete[] contents; };  inline int get_length() { return header->length; };  inline void set_length(int len) { header->length = len; };  inline int get_conlength() { return header->conlength; };  inline char get_classnum() { return header->classnum; };  inline char get_ctype() { return header->ctype; };  inline unsigned char *get_contents() { return contents; };  virtual void dump_object();  RSVPobject *next;protected:  struct objheader *header;  unsigned char *contents;  // A pointer to the contents};/* There is no Protocol Id field in the SESSION class and the   'fl' (flags) argument to the constructor is ignored.   */class SESSION : public RSVPobject {public:  SESSION(nsaddr_t dst, char fl, int f, char ip6);  SESSION(unsigned char *cont);  virtual ~SESSION() {};  inline nsaddr_t get_dest() { return con->dest; };  inline int get_fid() { return con->fid; };  void dump_object();private:  struct construct {    nsaddr_t dest;    int fid;  };  struct construct *con;};/* There is no logical interface handle in RSVP_HOP objects. In fact,   making sure that resv messages are routed through the correct   interfaces on all nodes is a problem if they pass through non-RSVP   clouds.   */class RSVP_HOP : public RSVPobject {public:  RSVP_HOP(nsaddr_t h, char ip6);  RSVP_HOP(unsigned char *cont);  virtual ~RSVP_HOP() {};  inline nsaddr_t get_hop() { return con->hop; };  void dump_object();private:  struct construct {    nsaddr_t hop;  };  struct construct *con;};class TIME_VALUES : public RSVPobject {public:  TIME_VALUES(double refresh);  TIME_VALUES(unsigned char *cont);  virtual ~TIME_VALUES() {};  inline double get_r() { return con->r; };  void dump_object();private:  struct construct {    double r;  };  struct construct *con;};class ERROR_SPEC : public RSVPobject {public:  ERROR_SPEC(nsaddr_t node, char fl, char code, int value, char ip6);  ERROR_SPEC(unsigned char *cont);  virtual ~ERROR_SPEC() {};  inline nsaddr_t get_errnode() { return con->errnode; };  inline char get_flags() { return con->flags; };  inline char get_errcode() { return con->errcode; };  inline int get_errvalue() { return con->errvalue; };  void dump_object();private:  struct construct {    nsaddr_t errnode;    char flags;    char errcode;    int errvalue;  };  struct construct *con;};class STYLE : public RSVPobject {public:  STYLE(long st);  STYLE(unsigned char *cont);  virtual ~STYLE() {};  inline long get_style() { return con->style; };  void dump_object();private:  struct construct {    long style;  };  struct construct *con;};/* At the moment, only FLOWSPEC objects for controlled-load service   (RFC 2211) are supported. There is no peak rate minimum policed unit    and maximum packet size.   */class FLOWSPEC : public RSVPobject {public:  FLOWSPEC(double r, long s);  FLOWSPEC(unsigned char *cont);  virtual ~FLOWSPEC() {};  inline double get_rate() { return con->rate; };  inline long get_size() { return con->size; };  void dump_object();private:  struct construct {    double rate;    long size;  };  struct construct *con;};/* Flows are only distinguished by their flow id (fid) which is   defined for each flow in the SESSION class, hence one of   the two FILTER_SPEC objects for IPv6 is obsolete. The C-Type for   FILTER_SPECs is either 1 or 3 in this implementation.   */class FILTER_SPEC : public RSVPobject {public:  FILTER_SPEC(nsaddr_t src, char ip6);  FILTER_SPEC(unsigned char *cont);  virtual ~FILTER_SPEC() {};  inline long get_addr() { return con->addr; };  void dump_object();private:  struct construct {    long addr;  };  struct construct *con;};class SENDER_TEMPLATE : public RSVPobject {public:  SENDER_TEMPLATE(nsaddr_t src, char ip6);  SENDER_TEMPLATE(unsigned char *cont);  virtual ~SENDER_TEMPLATE() {};  inline long get_addr() { return con->addr; };  void dump_object();private:  struct construct {    long addr;  };  struct construct *con;};class SENDER_TSPEC : public RSVPobject {public:  SENDER_TSPEC(double r, long s);  SENDER_TSPEC(unsigned char *cont);  virtual ~SENDER_TSPEC() {};  inline double get_rate() { return con->rate; };  inline long get_size() { return con->size; };  void dump_object();private:  struct construct {    double rate;    long size;  };  struct construct *con;};class RESV_CONFIRM : public RSVPobject {public:  RESV_CONFIRM(nsaddr_t a, char ip6);  RESV_CONFIRM(unsigned char *cont);  virtual ~RESV_CONFIRM() {};  inline long get_addr() { return con->addr; };  void dump_object();private:  struct construct {    long addr;  };  struct construct *con;};#endif

⌨️ 快捷键说明

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