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

📄 rsvp-messages.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_messages_h#define ns_rsvp_messages_h#include "rsvp-objects.h"#include "stdio.h"#define PATH     1#define RESV     2#define PATHERR  3#define RESVERR  4#define PATHTEAR 5#define RESVTEAR 6#define RESVCONF 7/* The common header for all RSVP messages */struct common_header {  char type;       // The message type  char send_TTL;   // The IP TTL with which the message was sent  int length;      // The "simulated" length of the message  int conlength;   // The "real" length of the message};/* RSVPmessage is the only class for all RSVP messages. That seems to be   better than having one single class for each RSVP message (Path,   Resv, etc.). There are two constructors: One which is used to   construct a new RSVP message and receives the type and ttl as   arguments, and one which is used to reconstruct the single objects    from an RSVP message that was received from another node. The only    argument for the latter is a pointer to a buffer which contains the    contents of the message. The class copies the buffer into its local   buffer.   */class RSVPmessage { public:  RSVPmessage(char ty, char ttl);  RSVPmessage(unsigned char *cont);  ~RSVPmessage() { if (con) delete[] contents; delete_objects(); };  unsigned char *get_contents();  inline int get_type() { return header.type; };  inline int get_length() { return header.length; };  inline int get_conlength() { return header.conlength; };  inline int get_ttl() { return header.send_TTL; };  inline void set_ttl(char ttl) { header.send_TTL = ttl; };  RSVPobject *get_first(char classnum);  void delete_first(char classnum);  void add_object(RSVPobject *obj);  void dump_message();private:      void delete_objects();  int con;  unsigned char *contents;  /* A pointer to the contents */  RSVPobject *objects;      /* The head of the linked list with the objects */  RSVPobject *tail;         /* The tail of the object list */  struct common_header header; /* The common header for the message */};   #endif

⌨️ 快捷键说明

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