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

📄 rsvp.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_h#define ns_rsvp_h#include "packet.h"#include "ip.h"#include "agent.h"#include "address.h"#include "adc.h"#include "rsvp-objects.h"#include "rsvp-messages.h"#include "rsvp-link.h"/* The MAXSID was chosen arbitrarily, but should be enough for most   simulations */#define MAXSID 1000000#define UPC_PATH 1#define UPC_RESV 2#define UPC_RESVERR 4#define UPC_RESVCONF 8#define UPC_PATHTO 16#define UPC_PATHTEAR 32#define UPC_RESVTO 64#define UPC_RESVTEAR 128 struct hdr_rsvp {  nsaddr_t fromhop;};struct tcsb {  tcsb() : fl(0), ofl(0), next(0) {};  FLOWSPEC *fl; /* The flowspec for the reservation on the iface to sender */  FLOWSPEC *ofl; /* The forwarded flowspec on the iface to sender */   nsaddr_t oifhop;  nsaddr_t sender;  TclObject *handle;  tcsb *next;};struct psb {  psb() : next(0) {};  SENDER_TEMPLATE *sender;  SENDER_TSPEC *s_tspec;  RSVP_HOP *phop;  char ttl;  double timeout;  int iif;  RSVPChecker *check;  psb *next;};struct rsb {  rsb() :  confirm(0), modified(0), is_new(0), processed(0), next(0) {};  RSVP_HOP *nhop;  FILTER_SPEC *sender;  FLOWSPEC *fspec;  STYLE *st;  RESV_CONFIRM *confirm;  psb *p;  nsaddr_t oifhop;  double timeout;  char modified;  char is_new;  char processed;  rsb *old;  rsb *next;};struct session {  session() : path_ref(-1), resv_ref(-1), psb_list(0), rsb_list(0),	      tcsb_list(0), next(0), t_next(0), ref_flag(0), confirm(0) {};  ~session() { delete s; delete path_tv; delete resv_tv; }  SESSION *s;  long sid;  int status;  char handle[8];  TIME_VALUES *path_tv;  TIME_VALUES *resv_tv;  double path_ref;  // The time at which the path state is refreshed  double resv_ref;  // The time at which the resv state is refreshed  psb *psb_list;  rsb *rsb_list;  tcsb *tcsb_list;  session *next;    // The next session in the session list  session *t_next;  // The next session in the timer list  char ref_flag;    // Has this session been scheduled for a refresh?  char local;       // Did this session originate from a local API call?  char confirm;     // Will a RESV_CONFIRM object be sent with the next Resv?};class RSVPAgent : public Agent { public:  RSVPAgent();  int command(int argc, const char*const* argv);  void recv(Packet* p, Handler* h);  void give(Packet *p, RSVPChecker *ret); protected:   int new_session_sid(nsaddr_t dst, int fid, char local);  session *new_session_p(nsaddr_t dst, int fid, char local);  void new_psb(session *s, double rate, long bucket, char ttl,	       nsaddr_t sender, nsaddr_t phop, double refresh, 	       int iface, RSVPChecker *check);  rsb *new_rsb(session *s, psb *p, nsaddr_t sender, FLOWSPEC *fl,	       const char *style, nsaddr_t nhop, double refresh,	       nsaddr_t fromhop);  void update_psb(session *s, psb *p, double rate, long bucket, char ttl,		  nsaddr_t sender, nsaddr_t phop, double refresh, 		  int iface, RSVPChecker *check);  void update_rsb(session *s, rsb *r, psb *p, nsaddr_t sender, FLOWSPEC *fl,		  const char *style, nsaddr_t nhop, double refresh,		  nsaddr_t fromhop);  void refresh_path(session *s);  void refresh_resv(session *s, char forced);  void clear_rsb(rsb *r);  void clear_psb(psb *p);  void delete_rsbs(session *s, psb *p);  void refresh();  char check_path(session *s);  char check_resv(session *s);  char is_leaf(nsaddr_t src, nsaddr_t dst);  inline char is_mcast(nsaddr_t addr)     { return ((unsigned int) addr >=	      (unsigned int) 1 << Address::instance().McastShift_); };  void list_sessions(char *buf, int size);  double minref(session *s);  void reschedule_session(session *s);  void release_session(session *s);  void remove_session(session *s);  void send_path_message(session *s, psb *p);  void send_path_tear_message(session *s, psb *p);  int send_resv_message(session *s, rsb *r, char forced);  void send_resv_conf_message(session *s, rsb *r);  void send_resv_err_message(RSVPmessage *resvmsg, int code);  void send_resv_err_message(session *s, RSVPmessage *resvmsg, rsb *r);  void send_resv_err_message(session *s, rsb *r);  void send_resv_tear_messages(session *s, rsb *r_list);  int update_traffic_control(session *s, rsb *r);  void process_ff_request(session *s, int argc,	const char*const* argv );  void process_path_message(RSVPmessage *msg, int iface, RSVPChecker *check);  void process_path_tear_message(RSVPmessage *msg, int iface, 				 RSVPChecker *check);  void process_resv_conf_message(RSVPmessage *msg);  void process_resv_err_message(RSVPmessage *msg);  void process_resv_message(RSVPmessage *msg, nsaddr_t fromhop);  void process_resv_tear_message(RSVPmessage *msg);  psb *find_psb(session *s, nsaddr_t sender);  rsb *find_rsb(session *s, nsaddr_t sender, nsaddr_t nhop);  int find_rsb_for_psb(session *s, psb *p);  session *find_session_sid(long sid);  session *find_session_dst(nsaddr_t dst, int fid);  char in_range(double x, double y);  int off_rsvp_;  int noisy_;    /* Turn output from the RSVP agent on/off */  double refresh_;  /* The default refresh value */  int lifetime_factor_; /* The factor "K" as described in RFC 2205 */  long next_sid_; /* The local session ID for the session */  int ip6_;     /* Should IPv6 message lengths be simulated? */  int nam_;     /* Should the correct RSVP message names appear in nam? */  session *s_list_; /* The session list */  session *t_list_; /* The timer list */  int num_flows_;  int num_psb_;  int num_rsb_;};#endif

⌨️ 快捷键说明

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