📄 rsvp-link.cc~
字号:
/* * 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. */#include "rsvp-link.h"static class RSVPLinkClass : public TclClass {public: RSVPLinkClass() : TclClass("RSVPLink") {} TclObject* create(int, const char*const*) { return (new RSVPLink()); }} class_RSVPLink;static class RSVPCheckerClass : public TclClass {public: RSVPCheckerClass() : TclClass("RSVPChecker") {} TclObject* create(int, const char*const*) { return (new RSVPChecker()); }} class_RSVPChecker;RSVPChecker::RSVPChecker() { bind("off_ip_", &off_ip_); bind("off_rsvp_", &off_rsvp_); bind("src_", &src_);}RSVPLink::RSVPLink() { bind_bw("besteffort_", &besteffort_);}/* The 'give' function allows the RSVP agent to hand a packet back to the link after it was processed. That way, RSVP agents don't have to worry about routing (especially multicast routing). */void RSVPChecker::give(Packet *p) { /* Simply forward the packet as if there was no RSVP agent */ target_->recv(p);}void RSVPChecker::recv(Packet* p, Handler* h) { hdr_cmn *hdr = (hdr_cmn*)p->access(off_cmn_); if ((hdr->ptype() >= PT_RSVP) && (hdr->ptype() <= PT_RESV_CONF)) { Tcl& tcl = Tcl::instance(); tcl.evalf("%s get-rsvp-agent", name()); if (strlen(tcl.result()) == 0) { target_->recv(p); } else { hdr_rsvp *rsvphdr = (hdr_rsvp*)p->access(off_rsvp_); rsvphdr->fromhop = src_; ((RSVPAgent *)TclObject::lookup(tcl.result()))->give(p, this); } } else { target_->recv(p); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -