INET Framework for OMNeT++/OMNEST
inet::RSVP Class Reference

TODO documentation. More...

#include <RSVP.h>

Inheritance diagram for inet::RSVP:
inet::IScriptable inet::ILifecycle

Classes

struct  HelloState_t
 RSVP Hello State structure. More...
 
struct  PathStateBlock_t
 Path State Block (PSB) structure. More...
 
struct  ResvStateBlock_t
 Reservation State Block (RSB) structure. More...
 
struct  traffic_path_t
 
struct  traffic_session_t
 

Public Member Functions

 RSVP ()
 
virtual ~RSVP ()
 
- Public Member Functions inherited from inet::IScriptable
virtual ~IScriptable ()
 
- Public Member Functions inherited from inet::ILifecycle
virtual ~ILifecycle ()
 

Protected Types

typedef std::vector< PathStateBlock_tPSBVector
 
typedef std::vector< ResvStateBlock_tRSBVector
 
typedef std::vector< HelloState_tHelloVector
 

Protected Member Functions

virtual void processSignallingMessage (SignallingMsg *msg)
 
virtual void processPSB_TIMER (PsbTimerMsg *msg)
 
virtual void processPSB_TIMEOUT (PsbTimeoutMsg *msg)
 
virtual void processRSB_REFRESH_TIMER (RsbRefreshTimerMsg *msg)
 
virtual void processRSB_COMMIT_TIMER (RsbCommitTimerMsg *msg)
 
virtual void processRSB_TIMEOUT (RsbTimeoutMsg *msg)
 
virtual void processHELLO_TIMER (HelloTimerMsg *msg)
 
virtual void processHELLO_TIMEOUT (HelloTimeoutMsg *msg)
 
virtual void processPATH_NOTIFY (PathNotifyMsg *msg)
 
virtual void processRSVPMessage (RSVPMessage *msg)
 
virtual void processHelloMsg (RSVPHelloMsg *msg)
 
virtual void processPathMsg (RSVPPathMsg *msg)
 
virtual void processResvMsg (RSVPResvMsg *msg)
 
virtual void processPathTearMsg (RSVPPathTear *msg)
 
virtual void processPathErrMsg (RSVPPathError *msg)
 
virtual PathStateBlock_tcreatePSB (RSVPPathMsg *msg)
 
virtual PathStateBlock_tcreateIngressPSB (const traffic_session_t &session, const traffic_path_t &path)
 
virtual void removePSB (PathStateBlock_t *psb)
 
virtual ResvStateBlock_tcreateRSB (RSVPResvMsg *msg)
 
virtual ResvStateBlock_tcreateEgressRSB (PathStateBlock_t *psb)
 
virtual void updateRSB (ResvStateBlock_t *rsb, RSVPResvMsg *msg)
 
virtual void removeRSB (ResvStateBlock_t *rsb)
 
virtual void removeRsbFilter (ResvStateBlock_t *rsb, unsigned int index)
 
virtual void refreshPath (PathStateBlock_t *psbEle)
 
virtual void refreshResv (ResvStateBlock_t *rsbEle)
 
virtual void refreshResv (ResvStateBlock_t *rsbEle, IPv4Address PHOP)
 
virtual void commitResv (ResvStateBlock_t *rsb)
 
virtual void scheduleRefreshTimer (PathStateBlock_t *psbEle, simtime_t delay)
 
virtual void scheduleTimeout (PathStateBlock_t *psbEle)
 
virtual void scheduleRefreshTimer (ResvStateBlock_t *rsbEle, simtime_t delay)
 
virtual void scheduleCommitTimer (ResvStateBlock_t *rsbEle)
 
virtual void scheduleTimeout (ResvStateBlock_t *rsbEle)
 
virtual void sendPathErrorMessage (PathStateBlock_t *psb, int errCode)
 
virtual void sendPathErrorMessage (SessionObj_t session, SenderTemplateObj_t sender, SenderTspecObj_t tspec, IPv4Address nextHop, int errCode)
 
virtual void sendPathTearMessage (IPv4Address peerIP, const SessionObj_t &session, const SenderTemplateObj_t &sender, IPv4Address LIH, IPv4Address NHOP, bool force)
 
virtual void sendPathNotify (int handler, const SessionObj_t &session, const SenderTemplateObj_t &sender, int status, simtime_t delay)
 
virtual void setupHello ()
 
virtual void startHello (IPv4Address peer, simtime_t delay)
 
virtual void removeHello (HelloState_t *h)
 
virtual void recoveryEvent (IPv4Address peer)
 
virtual bool allocateResource (IPv4Address OI, const SessionObj_t &session, double bandwidth)
 
virtual void preempt (IPv4Address OI, int priority, double bandwidth)
 
virtual bool doCACCheck (const SessionObj_t &session, const SenderTspecObj_t &tspec, IPv4Address OI)
 
virtual void announceLinkChange (int tedlinkindex)
 
virtual void sendToIP (cMessage *msg, IPv4Address destAddr)
 
virtual bool evalNextHopInterface (IPv4Address destAddr, const EroVector &ERO, IPv4Address &OI)
 
virtual PathStateBlock_tfindPSB (const SessionObj_t &session, const SenderTemplateObj_t &sender)
 
virtual ResvStateBlock_tfindRSB (const SessionObj_t &session, const SenderTemplateObj_t &sender, unsigned int &index)
 
virtual PathStateBlock_tfindPsbById (int id)
 
virtual ResvStateBlock_tfindRsbById (int id)
 
std::vector< traffic_session_t >::iterator findSession (const SessionObj_t &session)
 
std::vector< traffic_path_t >::iterator findPath (traffic_session_t *session, const SenderTemplateObj_t &sender)
 
virtual HelloState_tfindHello (IPv4Address peer)
 
virtual void print (RSVPPathMsg *p)
 
virtual void print (RSVPResvMsg *r)
 
virtual void readTrafficFromXML (const cXMLElement *traffic)
 
virtual void readTrafficSessionFromXML (const cXMLElement *session)
 
virtual EroVector readTrafficRouteFromXML (const cXMLElement *route)
 
virtual void createPath (const SessionObj_t &session, const SenderTemplateObj_t &sender)
 
virtual void pathProblem (PathStateBlock_t *psb)
 
virtual void addSession (const cXMLElement &node)
 
virtual void delSession (const cXMLElement &node)
 
virtual int getInLabel (const SessionObj_t &session, const SenderTemplateObj_t &sender)
 
virtual int numInitStages () const override
 
virtual void initialize (int stage) override
 
virtual void handleMessage (cMessage *msg) override
 
virtual void clear ()
 
virtual bool handleOperationStage (LifecycleOperation *operation, int stage, IDoneCallback *doneCallback) override
 Perform one stage of a lifecycle operation. More...
 
virtual void processCommand (const cXMLElement &node) override
 Called by ScenarioManager whenever a script command needs to be carried out by the module. More...
 

Protected Attributes

std::vector< traffic_session_ttraffic
 
simtime_t helloInterval
 
simtime_t helloTimeout
 
simtime_t retryInterval
 
TEDtedmod = nullptr
 
IIPv4RoutingTablert = nullptr
 
IInterfaceTableift = nullptr
 
LIBTablelt = nullptr
 
IRSVPClassifierrpct = nullptr
 
int maxPsbId = 0
 
int maxRsbId = 0
 
int maxSrcInstance = 0
 
IPv4Address routerId
 
PSBVector PSBList
 
RSBVector RSBList
 
HelloVector HelloList
 

Friends

class SimpleClassifier
 

Detailed Description

TODO documentation.

Member Typedef Documentation

typedef std::vector<HelloState_t> inet::RSVP::HelloVector
protected
typedef std::vector<PathStateBlock_t> inet::RSVP::PSBVector
protected
typedef std::vector<ResvStateBlock_t> inet::RSVP::RSBVector
protected

Constructor & Destructor Documentation

inet::RSVP::RSVP ( )
46 {
47 }
inet::RSVP::~RSVP ( )
virtual
50 {
51  // TODO cancelAndDelete timers in all data structures
52  for (auto& psb: PSBList) {
53  cancelAndDelete(psb.timerMsg);
54  cancelAndDelete(psb.timeoutMsg);
55  }
56  for (auto& rsb: RSBList) {
57  cancelAndDelete(rsb.refreshTimerMsg);
58  cancelAndDelete(rsb.commitTimerMsg);
59  cancelAndDelete(rsb.timeoutMsg);
60  }
61  for (auto& hello: HelloList) {
62  cancelAndDelete(hello.timer);
63  cancelAndDelete(hello.timeout);
64  }
65 }
PSBVector PSBList
Definition: RSVP.h:189
RSBVector RSBList
Definition: RSVP.h:190
HelloVector HelloList
Definition: RSVP.h:191

Member Function Documentation

void inet::RSVP::addSession ( const cXMLElement &  node)
protectedvirtual
1752 {
1753  Enter_Method_Silent();
1754 
1756 }
virtual void readTrafficSessionFromXML(const cXMLElement *session)
Definition: RSVP.cc:193
bool inet::RSVP::allocateResource ( IPv4Address  OI,
const SessionObj_t session,
double  bandwidth 
)
protectedvirtual
708 {
709  if (OI.isUnspecified())
710  return true;
711 
712  if (!tedmod->isLocalAddress(OI))
713  return true;
714 
715  if (bandwidth == 0.0)
716  return true;
717 
718  int setupPri = session.setupPri;
719  int holdingPri = session.holdingPri;
720 
721  unsigned int index = tedmod->linkIndex(OI);
722 
723  // Note: UnRB[7] <= UnRW[setupPri] <= UnRW[holdingPri] <= BW[0]
724  // UnRW[7] is the actual BW left on the link
725 
726  if (tedmod->ted[index].UnResvBandwidth[setupPri] < bandwidth)
727  return false;
728 
729  for (int p = holdingPri; p < 8; p++) {
730  tedmod->ted[index].UnResvBandwidth[p] -= bandwidth;
731 
732  if (tedmod->ted[index].UnResvBandwidth[p] < 0.0)
733  preempt(OI, p, -tedmod->ted[index].UnResvBandwidth[p]);
734  }
735 
736  // announce changes
737 
738  announceLinkChange(index);
739 
740  return true;
741 }
virtual unsigned int linkIndex(IPv4Address localInf)
Definition: TED.cc:429
virtual bool isLocalAddress(IPv4Address addr)
Definition: TED.cc:449
virtual void announceLinkChange(int tedlinkindex)
Definition: RSVP.cc:743
TELinkStateInfoVector ted
The link state database.
Definition: TED.h:64
TED * tedmod
Definition: RSVP.h:175
virtual void preempt(IPv4Address OI, int priority, double bandwidth)
Definition: RSVP.cc:674
void inet::RSVP::announceLinkChange ( int  tedlinkindex)
protectedvirtual
744 {
745  TEDChangeInfo d;
746  d.setTedLinkIndicesArraySize(1);
747  d.setTedLinkIndices(0, tedlinkindex);
748  emit(NF_TED_CHANGED, &d);
749 }
simsignal_t NF_TED_CHANGED
Definition: NotifierConsts.cc:55
void inet::RSVP::clear ( )
protectedvirtual
2072 {
2073  while (!PSBList.empty())
2074  removePSB(&PSBList.front());
2075  while (!RSBList.empty())
2076  removeRSB(&RSBList.front());
2077  while (!HelloList.empty())
2078  removeHello(&HelloList.front());
2079 }
PSBVector PSBList
Definition: RSVP.h:189
virtual void removePSB(PathStateBlock_t *psb)
Definition: RSVP.cc:1032
RSBVector RSBList
Definition: RSVP.h:190
virtual void removeHello(HelloState_t *h)
Definition: RSVP.cc:376
virtual void removeRSB(ResvStateBlock_t *rsb)
Definition: RSVP.cc:1003
HelloVector HelloList
Definition: RSVP.h:191
void inet::RSVP::commitResv ( ResvStateBlock_t rsb)
protectedvirtual
752 {
753  EV_INFO << "commit reservation (RSB " << rsb->id << ")" << endl;
754 
755  // allocate bandwidth as needed
756 
757  EV_INFO << "currently allocated: " << rsb->Flowspec_Object << endl;
758 
759  while (true) {
760  // remove RSB if empty
761 
762  if (rsb->FlowDescriptor.size() == 0) {
763  removeRSB(rsb);
764  return;
765  }
766 
767  FlowSpecObj_t req;
768  unsigned int maxFlowIndex = 0;
769  req.req_bandwidth = rsb->FlowDescriptor[0].Flowspec_Object.req_bandwidth;
770 
771  for (unsigned int i = 1; i < rsb->FlowDescriptor.size(); i++) {
772  if (rsb->FlowDescriptor[i].Flowspec_Object.req_bandwidth > req.req_bandwidth) {
773  req.req_bandwidth = rsb->FlowDescriptor[i].Flowspec_Object.req_bandwidth;
774  maxFlowIndex = i;
775  }
776  }
777 
778  EV_INFO << "currently required: " << req << endl;
779 
780  double needed = req.req_bandwidth - rsb->Flowspec_Object.req_bandwidth;
781 
782  if (needed != 0.0) {
783  if (allocateResource(rsb->OI, rsb->Session_Object, needed)) {
784  // allocated (deallocated) successfully
785 
786  EV_DETAIL << "additional bandwidth of " << needed << " allocated sucessfully" << endl;
787 
788  rsb->Flowspec_Object.req_bandwidth += needed;
789  }
790  else {
791  // bandwidth not available
792 
793  ASSERT(rsb->inLabelVector.size() == rsb->FlowDescriptor.size());
794 
795  EV_DETAIL << "not enough bandwidth to accommodate this RSB" << endl;
796 
797  int lspid = rsb->FlowDescriptor[maxFlowIndex].Filter_Spec_Object.Lsp_Id;
798  int oldInLabel = rsb->inLabelVector[maxFlowIndex];
799  PathStateBlock_t *psb = findPSB(rsb->Session_Object, (SenderTemplateObj_t&)rsb->FlowDescriptor[maxFlowIndex].Filter_Spec_Object);
800 
801  EV_DETAIL << "removing filter lspid=" << lspid << " (max. flow)" << endl;
802 
803  rsb->FlowDescriptor.erase(rsb->FlowDescriptor.begin() + maxFlowIndex);
804  rsb->inLabelVector.erase(rsb->inLabelVector.begin() + maxFlowIndex);
805 
806  if (oldInLabel != -1) {
807  // path already existed, this must be preemption
808 
810 
811  lt->removeLibEntry(oldInLabel);
812  }
813  else {
814  // path not established yet, report as unfeasible
815 
817  }
818 
819  continue;
820  }
821  }
822 
823  break;
824  }
825 
826  // install labels into lib
827 
828  for (unsigned int i = 0; i < rsb->FlowDescriptor.size(); i++) {
829  int lspid = rsb->FlowDescriptor[i].Filter_Spec_Object.Lsp_Id;
830 
831  EV_DETAIL << "processing lspid=" << lspid << endl;
832 
833  PathStateBlock_t *psb = findPSB(rsb->Session_Object, rsb->FlowDescriptor[i].Filter_Spec_Object);
834 
835  LabelOpVector outLabel;
836  std::string inInterface, outInterface;
837 
838  bool IR = (psb->Previous_Hop_Address == routerId);
839  //bool ER = psb->OutInterface.isUnspecified();
840  if (!IR) {
841  IPv4Address localInf = tedmod->getInterfaceAddrByPeerAddress(psb->Previous_Hop_Address);
842  inInterface = rt->getInterfaceByAddress(localInf)->getName();
843  }
844  else
845  inInterface = "any";
846 
847  // outlabel and outgoing interface
848 
849  LabelOp lop;
850 
851  if (tedmod->isLocalAddress(psb->OutInterface)) {
852  // regular next hop
853 
854  lop.optcode = IR ? PUSH_OPER : SWAP_OPER;
855  lop.label = rsb->FlowDescriptor[i].label;
856  outLabel.push_back(lop);
857 
858  outInterface = rt->getInterfaceByAddress(psb->OutInterface)->getName();
859  }
860  else {
861  // egress router
862 
863  lop.label = 0;
864  lop.optcode = POP_OPER;
865  outLabel.push_back(lop);
866 
867  outInterface = "lo0";
868 
869  if (!tedmod->isLocalAddress(psb->Session_Object.DestAddress)) {
870  InterfaceEntry *ie = rt->getInterfaceForDestAddr(psb->Session_Object.DestAddress);
871  if (ie)
872  outInterface = ie->getName(); // FIXME why use name to identify an interface?
873  }
874  }
875 
876  EV_DETAIL << "installing label for " << lspid << " outLabel=" << outLabel
877  << " outInterface=" << outInterface << endl;
878 
879  ASSERT(rsb->inLabelVector.size() == rsb->FlowDescriptor.size());
880 
881  int inLabel = lt->installLibEntry(rsb->inLabelVector[i], inInterface,
882  outLabel, outInterface, psb->color);
883 
884  ASSERT(inLabel >= 0);
885 
886  if (IR && rsb->inLabelVector[i] == -1) {
887  // path established
888  sendPathNotify(psb->handler, psb->Session_Object, psb->Sender_Template_Object, PATH_CREATED, 0.0);
889  }
890 
891  if (rsb->inLabelVector[i] != inLabel) {
892  // remember our current label
893  rsb->inLabelVector[i] = inLabel;
894 
895  // bind fec
896  rpct->bind(psb->Session_Object, psb->Sender_Template_Object, inLabel);
897  }
898 
899  // schedule commit of merging backups too...
900  for (auto & elem : RSBList) {
901  if (elem.OI == IPv4Address(lspid))
902  scheduleCommitTimer(&elem);
903  }
904  }
905 }
#define PATH_ERR_PREEMPTED
Definition: RSVP.cc:38
virtual InterfaceEntry * getInterfaceByAddress(const IPv4Address &address) const =0
Returns an interface given by its address.
LIBTable * lt
Definition: RSVP.h:178
virtual bool isLocalAddress(IPv4Address addr)
Definition: TED.cc:449
std::vector< LabelOp > LabelOpVector
Definition: LIBTable.h:44
virtual void removeLibEntry(int inLabel)
Definition: LIBTable.cc:93
virtual InterfaceEntry * getInterfaceForDestAddr(const IPv4Address &dest) const =0
Convenience function based on findBestMatchingRoute().
IIPv4RoutingTable * rt
Definition: RSVP.h:176
virtual void sendPathNotify(int handler, const SessionObj_t &session, const SenderTemplateObj_t &sender, int status, simtime_t delay)
Definition: RSVP.cc:393
#define PATH_ERR_UNFEASIBLE
Definition: RSVP.cc:37
virtual PathStateBlock_t * findPSB(const SessionObj_t &session, const SenderTemplateObj_t &sender)
Definition: RSVP.cc:1966
#define POP_OPER
Definition: LIBTable.h:33
#define PATH_CREATED
Definition: SignallingMsg_m.h:46
virtual void scheduleCommitTimer(ResvStateBlock_t *rsbEle)
Definition: RSVP.cc:1937
RSBVector RSBList
Definition: RSVP.h:190
IPv4Address routerId
Definition: RSVP.h:187
virtual bool allocateResource(IPv4Address OI, const SessionObj_t &session, double bandwidth)
Definition: RSVP.cc:707
TED * tedmod
Definition: RSVP.h:175
virtual int installLibEntry(int inLabel, std::string inInterface, const LabelOpVector &outLabel, std::string outInterface, int color)
Definition: LIBTable.cc:64
virtual void removeRSB(ResvStateBlock_t *rsb)
Definition: RSVP.cc:1003
#define SWAP_OPER
Definition: LIBTable.h:32
virtual void bind(const SessionObj_t &session, const SenderTemplateObj_t &sender, int inLabel)=0
#define PUSH_OPER
Definition: LIBTable.h:31
virtual void sendPathErrorMessage(PathStateBlock_t *psb, int errCode)
Definition: RSVP.cc:1853
virtual IPv4Address getInterfaceAddrByPeerAddress(IPv4Address peerIP)
Definition: TED.cc:315
IRSVPClassifier * rpct
Definition: RSVP.h:180
RSVP::ResvStateBlock_t * inet::RSVP::createEgressRSB ( PathStateBlock_t psb)
protectedvirtual
1222 {
1223  ResvStateBlock_t rsbEle;
1224 
1225  rsbEle.id = ++maxRsbId;
1226 
1227  rsbEle.timeoutMsg = new RsbTimeoutMsg("rsb timeout");
1228  rsbEle.timeoutMsg->setId(rsbEle.id);
1229 
1230  rsbEle.refreshTimerMsg = new RsbRefreshTimerMsg("rsb timer");
1231  rsbEle.refreshTimerMsg->setId(rsbEle.id);
1232 
1233  rsbEle.commitTimerMsg = new RsbCommitTimerMsg("rsb commit");
1234  rsbEle.commitTimerMsg->setId(rsbEle.id);
1235 
1236  rsbEle.Session_Object = psb->Session_Object;
1237  rsbEle.Next_Hop_Address = psb->Previous_Hop_Address;
1238 
1239  rsbEle.OI = psb->OutInterface;
1240 
1241  FlowDescriptor_t flow;
1242  flow.Flowspec_Object = (FlowSpecObj_t&)psb->Sender_Tspec_Object;
1243  flow.Filter_Spec_Object = (FilterSpecObj_t&)psb->Sender_Template_Object;
1244  flow.label = -1;
1245 
1246  rsbEle.FlowDescriptor.push_back(flow);
1247  rsbEle.inLabelVector.push_back(-1);
1248 
1249  RSBList.push_back(rsbEle);
1250  ResvStateBlock_t *rsb = &(*(RSBList.end() - 1));
1251 
1252  EV_INFO << "created new (egress) RSB " << rsb->id << endl;
1253 
1254  return rsb;
1255 }
int maxRsbId
Definition: RSVP.h:183
RSBVector RSBList
Definition: RSVP.h:190
uint32_t flow
Definition: TCP_NSC.cc:75
RSVP::PathStateBlock_t * inet::RSVP::createIngressPSB ( const traffic_session_t session,
const traffic_path_t path 
)
protectedvirtual
1176 {
1177  EroVector ERO = path.ERO;
1178 
1179  while (ERO.size() > 0 && ERO[0].node == routerId) {
1180  // remove ourselves from the beginning of the hop list
1181  ERO.erase(ERO.begin());
1182  }
1183 
1184  IPv4Address OI;
1185 
1186  if (!evalNextHopInterface(session.sobj.DestAddress, ERO, OI))
1187  return nullptr;
1188 
1189  if (!doCACCheck(session.sobj, path.tspec, OI))
1190  return nullptr;
1191 
1192  EV_INFO << "CACCheck passed, creating PSB" << endl;
1193 
1194  PathStateBlock_t psbEle;
1195  psbEle.id = ++maxPsbId;
1196 
1197  psbEle.timeoutMsg = new PsbTimeoutMsg("psb timeout");
1198  psbEle.timeoutMsg->setId(psbEle.id);
1199 
1200  psbEle.timerMsg = new PsbTimerMsg("psb timer");
1201  psbEle.timerMsg->setId(psbEle.id);
1202 
1203  psbEle.Session_Object = session.sobj;
1204  psbEle.Sender_Template_Object = path.sender;
1205  psbEle.Sender_Tspec_Object = path.tspec;
1206 
1207  psbEle.Previous_Hop_Address = routerId;
1208 
1209  psbEle.OutInterface = OI;
1210  psbEle.ERO = ERO;
1211  psbEle.color = path.color;
1212 
1213  psbEle.handler = path.owner;
1214 
1215  PSBList.push_back(psbEle);
1216  PathStateBlock_t *cPSB = &(*(PSBList.end() - 1));
1217 
1218  return cPSB;
1219 }
PSBVector PSBList
Definition: RSVP.h:189
std::vector< struct EroObj_t > EroVector
Definition: IntServ_m.h:39
IPv4Address routerId
Definition: RSVP.h:187
virtual bool evalNextHopInterface(IPv4Address destAddr, const EroVector &ERO, IPv4Address &OI)
Definition: RSVP.cc:1064
virtual bool doCACCheck(const SessionObj_t &session, const SenderTspecObj_t &tspec, IPv4Address OI)
Definition: RSVP.cc:532
int maxPsbId
Definition: RSVP.h:182
void inet::RSVP::createPath ( const SessionObj_t session,
const SenderTemplateObj_t sender 
)
protectedvirtual
111 {
112  if (findPSB(session, sender)) {
113  EV_INFO << "path (PSB) already exists, doing nothing" << endl;
114  return;
115  }
116 
117  // find entry in traffic database
118 
119  auto sit = findSession(session);
120 
121  if (sit == traffic.end()) {
122  EV_INFO << "session not found in traffic database, path won't be created" << endl;
123  return;
124  }
125 
126  auto pit = findPath(&(*sit), sender);
127 
128  if (pit == sit->paths.end()) {
129  EV_INFO << "path doesn't belong to this session according to our database, doing nothing" << endl;
130  return;
131  }
132 
133  PathStateBlock_t *psb = createIngressPSB(*sit, *pit);
134  if (psb) {
135  // PSB successfully created, send path message downstream
136  scheduleRefreshTimer(psb, 0.0);
137  }
138  else {
139  EV_INFO << "ingress PSB couln't be created" << endl;
140 
141  // inform the owner of this path
142  sendPathNotify(pit->owner, sit->sobj, pit->sender, PATH_UNFEASIBLE, 0.0);
143 
144  // remove non-permanent path
145  if (!pit->permanent) {
146  EV_INFO << "removing path from traffic database" << endl;
147 
148  sit->paths.erase(pit--);
149  }
150  else {
151  EV_INFO << "path is permanent, we will try again later" << endl;
152 
153  sendPathNotify(getId(), sit->sobj, pit->sender, PATH_RETRY, retryInterval);
154  }
155  }
156 }
std::vector< traffic_path_t >::iterator findPath(traffic_session_t *session, const SenderTemplateObj_t &sender)
Definition: RSVP.cc:306
simtime_t retryInterval
Definition: RSVP.h:172
std::vector< traffic_session_t > traffic
Definition: RSVP.h:66
virtual void sendPathNotify(int handler, const SessionObj_t &session, const SenderTemplateObj_t &sender, int status, simtime_t delay)
Definition: RSVP.cc:393
virtual PathStateBlock_t * findPSB(const SessionObj_t &session, const SenderTemplateObj_t &sender)
Definition: RSVP.cc:1966
#define PATH_RETRY
Definition: SignallingMsg_m.h:50
virtual PathStateBlock_t * createIngressPSB(const traffic_session_t &session, const traffic_path_t &path)
Definition: RSVP.cc:1175
virtual void scheduleRefreshTimer(PathStateBlock_t *psbEle, simtime_t delay)
Definition: RSVP.cc:1899
std::vector< traffic_session_t >::iterator findSession(const SessionObj_t &session)
Definition: RSVP.cc:1741
#define PATH_UNFEASIBLE
Definition: SignallingMsg_m.h:47
RSVP::PathStateBlock_t * inet::RSVP::createPSB ( RSVPPathMsg msg)
protectedvirtual
1130 {
1131  const EroVector& ERO = msg->getERO();
1132  IPv4Address destAddr = msg->getDestAddress();
1133 
1134  //
1135 
1136  IPv4Address OI;
1137 
1138  if (!evalNextHopInterface(destAddr, ERO, OI))
1139  return nullptr;
1140 
1141  if (tedmod->isLocalAddress(OI) && !doCACCheck(msg->getSession(), msg->getSenderTspec(), OI))
1142  return nullptr; // not enough resources
1143 
1144  PathStateBlock_t psbEle;
1145 
1146  psbEle.id = ++maxPsbId;
1147 
1148  psbEle.timeoutMsg = new PsbTimeoutMsg("psb timeout");
1149  psbEle.timeoutMsg->setId(psbEle.id);
1150 
1151  psbEle.timerMsg = new PsbTimerMsg("psb timer");
1152  psbEle.timerMsg->setId(psbEle.id);
1153 
1154  psbEle.Session_Object = msg->getSession();
1155  psbEle.Sender_Template_Object = msg->getSenderTemplate();
1156  psbEle.Sender_Tspec_Object = msg->getSenderTspec();
1157 
1158  psbEle.Previous_Hop_Address = msg->getNHOP();
1159  //psbEle.LIH = msg->getLIH();
1160 
1161  psbEle.OutInterface = OI;
1162  psbEle.ERO = ERO;
1163 
1164  psbEle.color = msg->getColor();
1165  psbEle.handler = -1;
1166 
1167  PSBList.push_back(psbEle);
1168  PathStateBlock_t *cPSB = &(*(PSBList.end() - 1));
1169 
1170  EV_INFO << "created new PSB " << cPSB->id << endl;
1171 
1172  return cPSB;
1173 }
virtual bool isLocalAddress(IPv4Address addr)
Definition: TED.cc:449
PSBVector PSBList
Definition: RSVP.h:189
std::vector< struct EroObj_t > EroVector
Definition: IntServ_m.h:39
virtual bool evalNextHopInterface(IPv4Address destAddr, const EroVector &ERO, IPv4Address &OI)
Definition: RSVP.cc:1064
TED * tedmod
Definition: RSVP.h:175
virtual bool doCACCheck(const SessionObj_t &session, const SenderTspecObj_t &tspec, IPv4Address OI)
Definition: RSVP.cc:532
int maxPsbId
Definition: RSVP.h:182
RSVP::ResvStateBlock_t * inet::RSVP::createRSB ( RSVPResvMsg msg)
protectedvirtual
908 {
909  ResvStateBlock_t rsbEle;
910 
911  rsbEle.id = ++maxRsbId;
912 
913  rsbEle.timeoutMsg = new RsbTimeoutMsg("rsb timeout");
914  rsbEle.timeoutMsg->setId(rsbEle.id);
915 
916  rsbEle.refreshTimerMsg = new RsbRefreshTimerMsg("rsb timer");
917  rsbEle.refreshTimerMsg->setId(rsbEle.id);
918 
919  rsbEle.commitTimerMsg = new RsbCommitTimerMsg("rsb commit");
920  rsbEle.commitTimerMsg->setId(rsbEle.id);
921 
922  rsbEle.Session_Object = msg->getSession();
923  rsbEle.Next_Hop_Address = msg->getNHOP();
924  rsbEle.OI = msg->getLIH();
925 
926  ASSERT(rsbEle.inLabelVector.size() == rsbEle.FlowDescriptor.size());
927 
928  for (auto & elem : msg->getFlowDescriptor()) {
929  FlowDescriptor_t flow = elem;
930  rsbEle.FlowDescriptor.push_back(flow);
931  rsbEle.inLabelVector.push_back(-1);
932  }
933 
934  RSBList.push_back(rsbEle);
935  ResvStateBlock_t *rsb = &(*(RSBList.end() - 1));
936 
937  EV_INFO << "created new RSB " << rsb->id << endl;
938 
939  return rsb;
940 }
int maxRsbId
Definition: RSVP.h:183
RSBVector RSBList
Definition: RSVP.h:190
uint32_t flow
Definition: TCP_NSC.cc:75
void inet::RSVP::delSession ( const cXMLElement &  node)
protectedvirtual
1759 {
1760  Enter_Method_Silent();
1761 
1762  checkTags(&node, "tunnel_id extended_tunnel_id endpoint paths");
1763 
1764  SessionObj_t sobj;
1765 
1766  sobj.Tunnel_Id = getParameterIntValue(&node, "tunnel_id");
1767  sobj.Extended_Tunnel_Id = getParameterIPAddressValue(&node, "extended_tunnel_id", routerId).getInt();
1768  sobj.DestAddress = getParameterIPAddressValue(&node, "endpoint");
1769 
1770  auto sit = findSession(sobj);
1771  ASSERT(sit != traffic.end());
1772  traffic_session_t *session = &(*sit);
1773 
1774  const cXMLElement *paths = getUniqueChildIfExists(&node, "paths");
1775  cXMLElementList pathList;
1776  if (paths) {
1777  // only specified paths will be removed, session remains
1778 
1779  checkTags(paths, "path");
1780  pathList = paths->getChildrenByTagName("path");
1781  }
1782 
1783  for (auto it = session->paths.begin(); it != session->paths.end(); it++) {
1784  bool remove;
1785 
1786  if (paths) {
1787  remove = false;
1788 
1789  for (auto & elem : pathList) {
1790  if (it->sender.Lsp_Id == getParameterIntValue(elem, "lspid")) {
1791  // remove path from session
1792  remove = true;
1793  break;
1794  }
1795  }
1796  }
1797  else {
1798  // remove all paths
1799 
1800  remove = true;
1801  }
1802 
1803  if (remove) {
1804  PathStateBlock_t *psb = findPSB(session->sobj, it->sender);
1805  if (psb) {
1806  ASSERT(psb->ERO.size() > 0);
1807 
1808  sendPathTearMessage(psb->ERO[0].node, psb->Session_Object, psb->Sender_Template_Object,
1809  tedmod->getInterfaceAddrByPeerAddress(psb->ERO[0].node), routerId, true);
1810 
1811  removePSB(psb);
1812  }
1813 
1814  session->paths.erase(it--);
1815  }
1816  }
1817 
1818  if (!paths) {
1819  traffic.erase(sit);
1820  }
1821 }
IPv4Address getParameterIPAddressValue(const cXMLElement *ptr, const char *name, IPv4Address def)
Definition: XMLUtils.cc:120
std::vector< traffic_session_t > traffic
Definition: RSVP.h:66
virtual PathStateBlock_t * findPSB(const SessionObj_t &session, const SenderTemplateObj_t &sender)
Definition: RSVP.cc:1966
virtual void removePSB(PathStateBlock_t *psb)
Definition: RSVP.cc:1032
void checkTags(const cXMLElement *node, const char *allowed)
Definition: XMLUtils.cc:54
virtual void sendPathTearMessage(IPv4Address peerIP, const SessionObj_t &session, const SenderTemplateObj_t &sender, IPv4Address LIH, IPv4Address NHOP, bool force)
Definition: RSVP.cc:1835
std::vector< traffic_session_t >::iterator findSession(const SessionObj_t &session)
Definition: RSVP.cc:1741
IPv4Address routerId
Definition: RSVP.h:187
uint32 getInt() const
Returns the address as an int.
Definition: IPv4Address.h:197
TED * tedmod
Definition: RSVP.h:175
int getParameterIntValue(const cXMLElement *ptr, const char *name, int def)
Definition: XMLUtils.cc:105
const cXMLElement * getUniqueChildIfExists(const cXMLElement *node, const char *name)
Definition: XMLUtils.cc:17
virtual IPv4Address getInterfaceAddrByPeerAddress(IPv4Address peerIP)
Definition: TED.cc:315
bool inet::RSVP::doCACCheck ( const SessionObj_t session,
const SenderTspecObj_t tspec,
IPv4Address  OI 
)
protectedvirtual
533 {
534  ASSERT(tedmod->isLocalAddress(OI));
535 
536  int k = tedmod->linkIndex(OI);
537 
538  double sharedBW = 0.0;
539 
540  for (auto & elem : RSBList) {
541  if ((elem.Session_Object == session) && (elem.Flowspec_Object.req_bandwidth > sharedBW))
542  sharedBW = elem.Flowspec_Object.req_bandwidth;
543  }
544 
545  EV_DETAIL << "CACCheck: link=" << OI
546  << " requested=" << tspec.req_bandwidth
547  << " shared=" << sharedBW
548  << " available (immediately)=" << tedmod->ted[k].UnResvBandwidth[7]
549  << " available (preemptible)=" << tedmod->ted[k].UnResvBandwidth[session.setupPri] << endl;
550 
551  return tedmod->ted[k].UnResvBandwidth[session.setupPri] + sharedBW >= tspec.req_bandwidth;
552 }
virtual unsigned int linkIndex(IPv4Address localInf)
Definition: TED.cc:429
virtual bool isLocalAddress(IPv4Address addr)
Definition: TED.cc:449
RSBVector RSBList
Definition: RSVP.h:190
TELinkStateInfoVector ted
The link state database.
Definition: TED.h:64
TED * tedmod
Definition: RSVP.h:175
const double k
Definition: QAM16Modulation.cc:24
bool inet::RSVP::evalNextHopInterface ( IPv4Address  destAddr,
const EroVector ERO,
IPv4Address OI 
)
protectedvirtual
1065 {
1066  if (ERO.size() > 0) {
1067  // explicit routing
1068 
1069  if (ERO[0].L) {
1070  InterfaceEntry *ie = rt->getInterfaceForDestAddr(ERO[0].node);
1071 
1072  if (!ie) {
1073  EV_INFO << "next (loose) hop address " << ERO[0].node << " is currently unroutable" << endl;
1074  return false;
1075  }
1076 
1077  OI = ie->ipv4Data()->getIPAddress();
1078  }
1079  else {
1080  OI = tedmod->getInterfaceAddrByPeerAddress(ERO[0].node);
1081  }
1082 
1083  IPv4Address peer = tedmod->getPeerByLocalAddress(OI);
1084  HelloState_t *h = findHello(peer);
1085  if (!h)
1086  throw cRuntimeError("Peer %s on interface %s is not an RSVP peer", peer.str().c_str(), OI.str().c_str());
1087 
1088  // ok, only if next hop is up and running
1089 
1090  return h->ok;
1091  }
1092  else {
1093  // hop-by-hop routing
1094 
1095  if (!tedmod->isLocalAddress(destAddr)) {
1096  InterfaceEntry *ie = rt->getInterfaceForDestAddr(destAddr);
1097 
1098  if (!ie) {
1099  EV_INFO << "destination address " << destAddr << " is currently unroutable" << endl;
1100  return false;
1101  }
1102 
1103  OI = ie->ipv4Data()->getIPAddress();
1104 
1105  HelloState_t *h = findHello(tedmod->getPeerByLocalAddress(OI));
1106  if (!h) {
1107  // outgoing interface is not LSR, we are egress router
1108 
1109  OI = IPv4Address();
1110 
1111  return true;
1112  }
1113  else {
1114  // outgoing interface is LSR
1115 
1116  ASSERT(h->ok); // rt->getInterfaceForDestAddr() wouldn't choose this entry
1117 
1118  return h->ok;
1119  }
1120  }
1121  else {
1122  // destAddress is ours, we're egress
1123 
1124  return true;
1125  }
1126  }
1127 }
IPv4InterfaceData * ipv4Data() const
Definition: InterfaceEntry.h:221
virtual bool isLocalAddress(IPv4Address addr)
Definition: TED.cc:449
virtual InterfaceEntry * getInterfaceForDestAddr(const IPv4Address &dest) const =0
Convenience function based on findBestMatchingRoute().
IIPv4RoutingTable * rt
Definition: RSVP.h:176
virtual IPv4Address getPeerByLocalAddress(IPv4Address localInf)
Definition: TED.cc:484
IPv4Address getIPAddress() const
Definition: IPv4InterfaceData.h:177
TED * tedmod
Definition: RSVP.h:175
const value< double, compose< units::J, units::s > > h(6.62606896e-34)
virtual IPv4Address getInterfaceAddrByPeerAddress(IPv4Address peerIP)
Definition: TED.cc:315
virtual HelloState_t * findHello(IPv4Address peer)
Definition: RSVP.cc:1995
RSVP::HelloState_t * inet::RSVP::findHello ( IPv4Address  peer)
protectedvirtual
1996 {
1997  for (auto & elem : HelloList) {
1998  if (elem.peer == peer)
1999  return &(elem);
2000  }
2001  return nullptr;
2002 }
HelloVector HelloList
Definition: RSVP.h:191
std::vector< RSVP::traffic_path_t >::iterator inet::RSVP::findPath ( traffic_session_t session,
const SenderTemplateObj_t sender 
)
protected
307 {
308  auto it = session->paths.begin();
309  for ( ; it != session->paths.end(); it++) {
310  if (it->sender == sender)
311  break;
312  }
313  return it;
314 }
RSVP::PathStateBlock_t * inet::RSVP::findPSB ( const SessionObj_t session,
const SenderTemplateObj_t sender 
)
protectedvirtual
1967 {
1968  for (auto & elem : PSBList) {
1969  if ((elem.Session_Object == session) && (elem.Sender_Template_Object == sender))
1970  return &(elem);
1971  }
1972  return nullptr;
1973 }
PSBVector PSBList
Definition: RSVP.h:189
RSVP::PathStateBlock_t * inet::RSVP::findPsbById ( int  id)
protectedvirtual
1976 {
1977  for (auto & elem : PSBList) {
1978  if (elem.id == id)
1979  return &elem;
1980  }
1981  ASSERT(false);
1982  return nullptr; // prevent warning
1983 }
PSBVector PSBList
Definition: RSVP.h:189
RSVP::ResvStateBlock_t * inet::RSVP::findRSB ( const SessionObj_t session,
const SenderTemplateObj_t sender,
unsigned int &  index 
)
protectedvirtual
1948 {
1949  for (auto & elem : RSBList) {
1950  if (elem.Session_Object != session)
1951  continue;
1952 
1953  index = 0;
1954  for (auto fit = elem.FlowDescriptor.begin(); fit != elem.FlowDescriptor.end(); fit++) {
1955  if ((SenderTemplateObj_t&)fit->Filter_Spec_Object == sender) {
1956  return &(elem);
1957  }
1958  ++index;
1959  }
1960 
1961  // don't break here, may be in different (if outInterface is different)
1962  }
1963  return nullptr;
1964 }
RSBVector RSBList
Definition: RSVP.h:190
RSVP::ResvStateBlock_t * inet::RSVP::findRsbById ( int  id)
protectedvirtual
1986 {
1987  for (auto & elem : RSBList) {
1988  if (elem.id == id)
1989  return &elem;
1990  }
1991  ASSERT(false);
1992  return nullptr; // prevent warning
1993 }
RSBVector RSBList
Definition: RSVP.h:190
std::vector< RSVP::traffic_session_t >::iterator inet::RSVP::findSession ( const SessionObj_t session)
protected
1742 {
1743  auto it = traffic.begin();
1744  for ( ; it != traffic.end(); it++) {
1745  if (it->sobj == session)
1746  break;
1747  }
1748  return it;
1749 }
std::vector< traffic_session_t > traffic
Definition: RSVP.h:66
int inet::RSVP::getInLabel ( const SessionObj_t session,
const SenderTemplateObj_t sender 
)
protectedvirtual
101 {
102  unsigned int index;
103  ResvStateBlock_t *rsb = findRSB(session, sender, index);
104  if (!rsb)
105  return -1;
106 
107  return rsb->inLabelVector[index];
108 }
virtual ResvStateBlock_t * findRSB(const SessionObj_t &session, const SenderTemplateObj_t &sender, unsigned int &index)
Definition: RSVP.cc:1947
void inet::RSVP::handleMessage ( cMessage *  msg)
overrideprotectedvirtual
1258 {
1259  SignallingMsg *sMsg = dynamic_cast<SignallingMsg *>(msg);
1260  RSVPMessage *rMsg = dynamic_cast<RSVPMessage *>(msg);
1261 
1262  if (sMsg) {
1264  return;
1265  }
1266  else if (rMsg) {
1267  processRSVPMessage(rMsg);
1268  return;
1269  }
1270  else
1271  ASSERT(false);
1272 }
virtual void processSignallingMessage(SignallingMsg *msg)
Definition: RSVP.cc:1631
virtual void processRSVPMessage(RSVPMessage *msg)
Definition: RSVP.cc:1274
bool inet::RSVP::handleOperationStage ( LifecycleOperation operation,
int  stage,
IDoneCallback doneCallback 
)
overrideprotectedvirtual

Perform one stage of a lifecycle operation.

Processing may be done entirely within this method, or may be a longer process that involves nonzero simulation time or several events, and is triggered by this method call.

Return value: true = "done"; false = "not yet done, will invoke doneCallback when done"

Implements inet::ILifecycle.

2082 {
2083  Enter_Method_Silent();
2084  if (dynamic_cast<NodeStartOperation *>(operation)) {
2086  setupHello();
2087  }
2088  else if (dynamic_cast<NodeShutdownOperation *>(operation)) {
2090  clear();
2091  }
2092  else if (dynamic_cast<NodeCrashOperation *>(operation)) {
2094  clear();
2095  }
2096  return true;
2097 }
virtual void clear()
Definition: RSVP.cc:2071
Stage
Definition: NodeOperations.h:71
Stage
Definition: NodeOperations.h:126
Stage
Definition: NodeOperations.h:46
Definition: NodeOperations.h:127
virtual void setupHello()
Definition: RSVP.cc:316
void inet::RSVP::initialize ( int  stage)
overrideprotectedvirtual
68 {
69  cSimpleModule::initialize(stage);
70 
71  if (stage == INITSTAGE_ROUTING_PROTOCOLS) {
72  tedmod = getModuleFromPar<TED>(par("tedModule"), this);
73  rt = getModuleFromPar<IIPv4RoutingTable>(par("routingTableModule"), this);
74  ift = getModuleFromPar<IInterfaceTable>(par("interfaceTableModule"), this);
75  routerId = rt->getRouterId();
76  lt = getModuleFromPar<LIBTable>(par("libTableModule"), this);
77  rpct = getModuleFromPar<IRSVPClassifier>(par("classifierModule"), this);
78 
79  maxPsbId = 0;
80  maxRsbId = 0;
81  maxSrcInstance = 0;
82 
83  retryInterval = 1.0;
84 
85  // setup hello
86  bool isOperational;
87  NodeStatus *nodeStatus = dynamic_cast<NodeStatus *>(findContainingNode(this)->getSubmodule("status"));
88  isOperational = (!nodeStatus) || nodeStatus->getState() == NodeStatus::UP;
89  if (isOperational)
90  setupHello();
91 
92  // process traffic configuration
93  readTrafficFromXML(par("traffic").xmlValue());
94 
95  IPSocket ipSocket(gate("ipOut"));
96  ipSocket.registerProtocol(IP_PROT_RSVP);
97  }
98 }
LIBTable * lt
Definition: RSVP.h:178
int maxRsbId
Definition: RSVP.h:183
simtime_t retryInterval
Definition: RSVP.h:172
IIPv4RoutingTable * rt
Definition: RSVP.h:176
IInterfaceTable * ift
Definition: RSVP.h:177
Initialization of routing protocols.
Definition: InitStages.h:101
int maxSrcInstance
Definition: RSVP.h:185
cModule * findContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:56
virtual void readTrafficFromXML(const cXMLElement *traffic)
Definition: RSVP.cc:158
IPv4Address routerId
Definition: RSVP.h:187
TED * tedmod
Definition: RSVP.h:175
int maxPsbId
Definition: RSVP.h:182
Definition: IPProtocolId_m.h:86
virtual void setupHello()
Definition: RSVP.cc:316
IRSVPClassifier * rpct
Definition: RSVP.h:180
Definition: NodeStatus.h:40
virtual int inet::RSVP::numInitStages ( ) const
inlineoverrideprotectedvirtual
286 { return NUM_INIT_STAGES; }
The number of initialization stages.
Definition: InitStages.h:116
void inet::RSVP::pathProblem ( PathStateBlock_t psb)
protectedvirtual
1673 {
1674  ASSERT(psb);
1675  ASSERT(!psb->OutInterface.isUnspecified());
1676 
1677  IPv4Address nextHop = tedmod->getPeerByLocalAddress(psb->OutInterface);
1678 
1679  EV_INFO << "sending PathTear to " << nextHop << endl;
1680 
1681  sendPathTearMessage(nextHop, psb->Session_Object, psb->Sender_Template_Object,
1682  tedmod->getInterfaceAddrByPeerAddress(nextHop), routerId, true);
1683 
1684  // schedule re-creation if path is permanent
1685 
1686  auto sit = findSession(psb->Session_Object);
1687  ASSERT(sit != traffic.end());
1688  traffic_session_t *s = &(*sit);
1689 
1690  auto pit = findPath(s, psb->Sender_Template_Object);
1691  ASSERT(pit != s->paths.end());
1692  traffic_path_t *p = &(*pit);
1693 
1694  if (p->permanent) {
1695  EV_INFO << "this path is permanent, we will try to re-create it later" << endl;
1696 
1697  sendPathNotify(getId(), psb->Session_Object, psb->Sender_Template_Object, PATH_RETRY, retryInterval);
1698  }
1699  else {
1700  EV_INFO << "removing path from traffic database" << endl;
1701 
1702  sit->paths.erase(pit);
1703  }
1704 
1705  // remove path
1706 
1707  EV_INFO << "removing PSB" << endl;
1708 
1709  removePSB(psb);
1710 }
std::vector< traffic_path_t >::iterator findPath(traffic_session_t *session, const SenderTemplateObj_t &sender)
Definition: RSVP.cc:306
simtime_t retryInterval
Definition: RSVP.h:172
std::vector< traffic_session_t > traffic
Definition: RSVP.h:66
virtual void sendPathNotify(int handler, const SessionObj_t &session, const SenderTemplateObj_t &sender, int status, simtime_t delay)
Definition: RSVP.cc:393
#define PATH_RETRY
Definition: SignallingMsg_m.h:50
virtual IPv4Address getPeerByLocalAddress(IPv4Address localInf)
Definition: TED.cc:484
virtual void removePSB(PathStateBlock_t *psb)
Definition: RSVP.cc:1032
virtual void sendPathTearMessage(IPv4Address peerIP, const SessionObj_t &session, const SenderTemplateObj_t &sender, IPv4Address LIH, IPv4Address NHOP, bool force)
Definition: RSVP.cc:1835
std::vector< traffic_session_t >::iterator findSession(const SessionObj_t &session)
Definition: RSVP.cc:1741
IPv4Address routerId
Definition: RSVP.h:187
TED * tedmod
Definition: RSVP.h:175
value< double, units::s > s
Definition: Units.h:1049
virtual IPv4Address getInterfaceAddrByPeerAddress(IPv4Address peerIP)
Definition: TED.cc:315
void inet::RSVP::preempt ( IPv4Address  OI,
int  priority,
double  bandwidth 
)
protectedvirtual
675 {
676  ASSERT(tedmod->isLocalAddress(OI));
677 
678  unsigned int index = tedmod->linkIndex(OI);
679 
680  for (auto & elem : RSBList) {
681  if (elem.OI != OI)
682  continue;
683 
684  if (elem.Session_Object.holdingPri != priority)
685  continue;
686 
687  if (elem.Flowspec_Object.req_bandwidth == 0.0)
688  continue;
689 
690  // preempt RSB
691 
692  for (int i = priority; i < 8; i++)
693  tedmod->ted[index].UnResvBandwidth[i] += elem.Flowspec_Object.req_bandwidth;
694 
695  bandwidth -= elem.Flowspec_Object.req_bandwidth;
696  elem.Flowspec_Object.req_bandwidth = 0.0;
697 
698  scheduleCommitTimer(&(elem));
699 
700  //
701 
702  if (bandwidth <= 0.0)
703  break;
704  }
705 }
virtual unsigned int linkIndex(IPv4Address localInf)
Definition: TED.cc:429
virtual bool isLocalAddress(IPv4Address addr)
Definition: TED.cc:449
virtual void scheduleCommitTimer(ResvStateBlock_t *rsbEle)
Definition: RSVP.cc:1937
RSBVector RSBList
Definition: RSVP.h:190
TELinkStateInfoVector ted
The link state database.
Definition: TED.h:64
TED * tedmod
Definition: RSVP.h:175
void inet::RSVP::print ( RSVPPathMsg p)
protectedvirtual
2058 {
2059  EV_INFO << "PATH_MESSAGE: lspid " << p->getLspId() << " ERO " << vectorToString(p->getERO()) << endl;
2060 }
std::string vectorToString(const IPAddressVector &vec)
Definition: Utils.cc:20
void inet::RSVP::print ( RSVPResvMsg r)
protectedvirtual
2063 {
2064  EV_INFO << "RESV_MESSAGE: " << endl;
2065  for (auto & elem : r->getFlowDescriptor()) {
2066  EV_INFO << " lspid " << elem.Filter_Spec_Object.Lsp_Id
2067  << " label " << elem.label << endl;
2068  }
2069 }
void inet::RSVP::processCommand ( const cXMLElement &  node)
overrideprotectedvirtual

Called by ScenarioManager whenever a script command needs to be carried out by the module.

The command is represented by the XML element or element tree. The command name can be obtained as:

const char *command = node->getTagName()

Parameters are XML attributes, e.g. a "neighbour" parameter can be retrieved as:

const char *attr = node->getAttribute("neighbour")

More complex input can be passed in child elements.

See also
cXMLElement

Implements inet::IScriptable.

1824 {
1825  if (!strcmp(node.getTagName(), "add-session")) {
1826  addSession(node);
1827  }
1828  else if (!strcmp(node.getTagName(), "del-session")) {
1829  delSession(node);
1830  }
1831  else
1832  ASSERT(false);
1833 }
virtual void addSession(const cXMLElement &node)
Definition: RSVP.cc:1751
virtual void delSession(const cXMLElement &node)
Definition: RSVP.cc:1758
void inet::RSVP::processHELLO_TIMEOUT ( HelloTimeoutMsg msg)
protectedvirtual
416 {
417  IPv4Address peer = msg->getPeer();
418 
419  EV_INFO << "hello timeout, considering " << peer << " failed" << endl;
420 
421  // update hello state (set to failed and turn hello off)
422 
423  HelloState_t *hello = findHello(peer);
424  ASSERT(hello);
425  hello->ok = false;
426  ASSERT(!hello->timeout->isScheduled());
427  cancelEvent(hello->timer);
428 
429  // update TED and routing table
430 
431  unsigned int index = tedmod->linkIndex(routerId, peer);
432  tedmod->ted[index].state = false;
433  announceLinkChange(index);
435 
436  // send PATH_ERROR for existing paths
437 
438  for (auto & elem : PSBList) {
439  if (elem.OutInterface == tedmod->ted[index].local)
441  }
442 }
virtual unsigned int linkIndex(IPv4Address localInf)
Definition: TED.cc:429
virtual void rebuildRoutingTable()
Definition: TED.cc:230
PSBVector PSBList
Definition: RSVP.h:189
virtual void announceLinkChange(int tedlinkindex)
Definition: RSVP.cc:743
IPv4Address routerId
Definition: RSVP.h:187
TELinkStateInfoVector ted
The link state database.
Definition: TED.h:64
TED * tedmod
Definition: RSVP.h:175
#define PATH_ERR_NEXTHOP_FAILED
Definition: RSVP.cc:39
virtual void sendPathErrorMessage(PathStateBlock_t *psb, int errCode)
Definition: RSVP.cc:1853
virtual HelloState_t * findHello(IPv4Address peer)
Definition: RSVP.cc:1995
void inet::RSVP::processHELLO_TIMER ( HelloTimerMsg msg)
protectedvirtual
445 {
446  IPv4Address peer = msg->getPeer();
447 
448  HelloState_t *h = findHello(peer);
449  ASSERT(h);
450 
451  RSVPHelloMsg *hMsg = new RSVPHelloMsg("hello message");
452 
453  hMsg->setSrcInstance(h->srcInstance);
454  hMsg->setDstInstance(h->dstInstance);
455 
456  hMsg->setRequest(h->request);
457  hMsg->setAck(h->ack);
458 
459  int length = 10;
460 
461  // see comment elsewhere (in TED.cc)
462  length /= 10;
463 
464  hMsg->setByteLength(length);
465 
466  sendToIP(hMsg, peer);
467 
468  h->ack = false;
469 
470  scheduleAt(simTime() + helloInterval, msg);
471 }
virtual void sendToIP(cMessage *msg, IPv4Address destAddr)
Definition: RSVP.cc:1877
simtime_t helloInterval
Definition: RSVP.h:170
const value< double, compose< units::J, units::s > > h(6.62606896e-34)
virtual HelloState_t * findHello(IPv4Address peer)
Definition: RSVP.cc:1995
void inet::RSVP::processHelloMsg ( RSVPHelloMsg msg)
protectedvirtual
1304 {
1305  EV_INFO << "Received RSVP_HELLO" << endl;
1306  //print(msg);
1307 
1308  IPv4ControlInfo *controlInfo = check_and_cast<IPv4ControlInfo *>(msg->getControlInfo());
1309  IPv4Address sender = controlInfo->getSrcAddr();
1310  IPv4Address peer = tedmod->primaryAddress(sender);
1311 
1312  bool request = msg->getRequest();
1313  bool ack = msg->getAck();
1314 
1315  EV_INFO << "hello sender " << peer;
1316  if (request)
1317  EV_INFO << " REQ";
1318  if (ack)
1319  EV_INFO << " ACK";
1320  EV_INFO << endl;
1321 
1322  int rcvSrcInstance = msg->getSrcInstance();
1323  int rcvDstInstance = msg->getDstInstance();
1324 
1325  delete msg;
1326 
1327  HelloState_t *h = findHello(peer);
1328  ASSERT(h);
1329 
1330  ASSERT(h->srcInstance);
1331  ASSERT(rcvSrcInstance);
1332 
1333  bool failure = false;
1334 
1335  if (h->srcInstance != rcvDstInstance) {
1336  if (rcvDstInstance != 0) {
1337  failure = true;
1338  }
1339  else {
1340  ASSERT(request);
1341  }
1342  }
1343 
1344  if (h->dstInstance != rcvSrcInstance) {
1345  if (h->dstInstance != 0) {
1346  failure = true;
1347  }
1348  h->dstInstance = rcvSrcInstance;
1349  }
1350 
1351  if (failure) {
1352  // mismatch encountered
1353  h->srcInstance = ++maxSrcInstance;
1354  }
1355 
1356  if (failure || !h->ok) {
1357  h->ok = true;
1358 
1359  EV_INFO << "local peer " << peer << " is now considered up and running" << endl;
1360 
1361  recoveryEvent(peer);
1362 
1363  // if peer was considered down, we have stopped sending hellos: resume now
1364  if (!h->timer->isScheduled())
1365  scheduleAt(simTime(), h->timer);
1366  }
1367 
1368  if (request) {
1369  // immediately respond to a request with an ack
1370  h->ack = true;
1371  h->request = false;
1372 
1373  cancelEvent(h->timer);
1374  scheduleAt(simTime(), h->timer);
1375  }
1376  else {
1377  // next message will be regular
1378 
1379  h->ack = false;
1380  h->request = false;
1381 
1382  ASSERT(h->timer->isScheduled());
1383  }
1384 
1385  cancelEvent(h->timeout);
1386  scheduleAt(simTime() + helloTimeout, h->timeout);
1387 }
virtual void recoveryEvent(IPv4Address peer)
Definition: RSVP.cc:1609
simtime_t helloTimeout
Definition: RSVP.h:171
int maxSrcInstance
Definition: RSVP.h:185
virtual IPv4Address primaryAddress(IPv4Address localInf)
Definition: TED.cc:471
TED * tedmod
Definition: RSVP.h:175
const value< double, compose< units::J, units::s > > h(6.62606896e-34)
virtual HelloState_t * findHello(IPv4Address peer)
Definition: RSVP.cc:1995
void inet::RSVP::processPATH_NOTIFY ( PathNotifyMsg msg)
protectedvirtual
1713 {
1714  PathStateBlock_t *psb;
1715 
1716  switch (msg->getStatus()) {
1717  case PATH_RETRY:
1718  createPath(msg->getSession(), msg->getSender());
1719  break;
1720 
1721  case PATH_UNFEASIBLE:
1722  case PATH_PREEMPTED:
1723  case PATH_FAILED:
1724  psb = findPSB(msg->getSession(), msg->getSender());
1725  if (psb)
1726  pathProblem(psb);
1727  break;
1728 
1729  case PATH_CREATED:
1730  EV_INFO << "Path successfully established" << endl;
1731  break;
1732 
1733  default:
1734  ASSERT(false);
1735  break;
1736  }
1737 
1738  delete msg;
1739 }
#define PATH_PREEMPTED
Definition: SignallingMsg_m.h:49
virtual void createPath(const SessionObj_t &session, const SenderTemplateObj_t &sender)
Definition: RSVP.cc:110
#define PATH_FAILED
Definition: SignallingMsg_m.h:48
virtual PathStateBlock_t * findPSB(const SessionObj_t &session, const SenderTemplateObj_t &sender)
Definition: RSVP.cc:1966
#define PATH_RETRY
Definition: SignallingMsg_m.h:50
#define PATH_CREATED
Definition: SignallingMsg_m.h:46
#define PATH_UNFEASIBLE
Definition: SignallingMsg_m.h:47
virtual void pathProblem(PathStateBlock_t *psb)
Definition: RSVP.cc:1672
void inet::RSVP::processPathErrMsg ( RSVPPathError msg)
protectedvirtual
1390 {
1391  EV_INFO << "Received PATH_ERROR" << endl;
1392  //print(msg);
1393 
1394  //int lspid = msg->getLspId();
1395  int errCode = msg->getErrorCode();
1396 
1397  PathStateBlock_t *psb = findPSB(msg->getSession(), msg->getSenderTemplate());
1398  if (!psb) {
1399  EV_INFO << "matching PSB not found, ignoring error message" << endl;
1400  delete msg;
1401  return;
1402  }
1403 
1404  if (psb->Previous_Hop_Address != routerId) {
1405  EV_INFO << "forwarding error message to PHOP (" << psb->Previous_Hop_Address << ")" << endl;
1406 
1407  delete msg->removeControlInfo();
1408  sendToIP(msg, psb->Previous_Hop_Address);
1409  }
1410  else {
1411  EV_INFO << "error reached ingress router" << endl;
1412 
1413  switch (errCode) {
1414  case PATH_ERR_PREEMPTED:
1415  sendPathNotify(psb->handler, psb->Session_Object, psb->Sender_Template_Object, PATH_PREEMPTED, 0.0);
1416  break;
1417 
1418  case PATH_ERR_UNFEASIBLE:
1419  sendPathNotify(psb->handler, psb->Session_Object, psb->Sender_Template_Object, PATH_UNFEASIBLE, 0.0);
1420  break;
1421 
1423  sendPathNotify(psb->handler, psb->Session_Object, psb->Sender_Template_Object, PATH_FAILED, 0.0);
1424  break;
1425 
1426  default:
1427  throw cRuntimeError("Invalid errorcode %d in message '%s'", errCode, msg->getName());
1428  }
1429 
1430  delete msg;
1431  }
1432 }
#define PATH_ERR_PREEMPTED
Definition: RSVP.cc:38
#define PATH_PREEMPTED
Definition: SignallingMsg_m.h:49
IPv4Address Previous_Hop_Address
Definition: RSVP.h:83
virtual void sendPathNotify(int handler, const SessionObj_t &session, const SenderTemplateObj_t &sender, int status, simtime_t delay)
Definition: RSVP.cc:393
#define PATH_FAILED
Definition: SignallingMsg_m.h:48
#define PATH_ERR_UNFEASIBLE
Definition: RSVP.cc:37
virtual PathStateBlock_t * findPSB(const SessionObj_t &session, const SenderTemplateObj_t &sender)
Definition: RSVP.cc:1966
virtual void sendToIP(cMessage *msg, IPv4Address destAddr)
Definition: RSVP.cc:1877
IPv4Address routerId
Definition: RSVP.h:187
#define PATH_UNFEASIBLE
Definition: SignallingMsg_m.h:47
#define PATH_ERR_NEXTHOP_FAILED
Definition: RSVP.cc:39
void inet::RSVP::processPathMsg ( RSVPPathMsg msg)
protectedvirtual
1492 {
1493  EV_INFO << "Received PATH_MESSAGE" << endl;
1494  print(msg);
1495 
1496  // process ERO *************************************************************
1497 
1498  EroVector ERO = msg->getERO();
1499 
1500  while (ERO.size() > 0 && ERO[0].node == routerId) {
1501  ERO.erase(ERO.begin());
1502  }
1503 
1504  msg->setERO(ERO);
1505 
1506  // create PSB if doesn't exist yet *****************************************
1507 
1508  PathStateBlock_t *psb = findPSB(msg->getSession(), msg->getSenderTemplate());
1509 
1510  if (!psb) {
1511  psb = createPSB(msg);
1512  if (!psb) {
1513  sendPathErrorMessage(msg->getSession(), msg->getSenderTemplate(),
1514  msg->getSenderTspec(), msg->getNHOP(), PATH_ERR_UNFEASIBLE);
1515  delete msg;
1516  return;
1517  }
1518  scheduleRefreshTimer(psb, 0.0);
1519 
1520  if (tedmod->isLocalAddress(psb->OutInterface)) {
1521  unsigned int index = tedmod->linkIndex(psb->OutInterface);
1522  if (!tedmod->ted[index].state) {
1524  }
1525  }
1526  }
1527 
1528  // schedule timer&timeout **************************************************
1529 
1530  scheduleTimeout(psb);
1531 
1532  // create RSB if we're egress and doesn't exist yet ************************
1533 
1534  unsigned int index;
1535  ResvStateBlock_t *rsb = findRSB(msg->getSession(), msg->getSenderTemplate(), index);
1536 
1537  if (!rsb && psb->OutInterface.isUnspecified()) {
1538  ASSERT(ERO.size() == 0);
1539  rsb = createEgressRSB(psb);
1540  ASSERT(rsb);
1541  scheduleCommitTimer(rsb);
1542  }
1543 
1544  if (rsb)
1545  scheduleRefreshTimer(rsb, 0.0);
1546 
1547  delete msg;
1548 }
virtual unsigned int linkIndex(IPv4Address localInf)
Definition: TED.cc:429
virtual PathStateBlock_t * createPSB(RSVPPathMsg *msg)
Definition: RSVP.cc:1129
virtual bool isLocalAddress(IPv4Address addr)
Definition: TED.cc:449
#define PATH_ERR_UNFEASIBLE
Definition: RSVP.cc:37
virtual PathStateBlock_t * findPSB(const SessionObj_t &session, const SenderTemplateObj_t &sender)
Definition: RSVP.cc:1966
virtual void scheduleRefreshTimer(PathStateBlock_t *psbEle, simtime_t delay)
Definition: RSVP.cc:1899
virtual ResvStateBlock_t * createEgressRSB(PathStateBlock_t *psb)
Definition: RSVP.cc:1221
virtual void scheduleCommitTimer(ResvStateBlock_t *rsbEle)
Definition: RSVP.cc:1937
std::vector< struct EroObj_t > EroVector
Definition: IntServ_m.h:39
virtual void print(RSVPPathMsg *p)
Definition: RSVP.cc:2057
virtual void scheduleTimeout(PathStateBlock_t *psbEle)
Definition: RSVP.cc:1889
IPv4Address routerId
Definition: RSVP.h:187
TELinkStateInfoVector ted
The link state database.
Definition: TED.h:64
TED * tedmod
Definition: RSVP.h:175
virtual ResvStateBlock_t * findRSB(const SessionObj_t &session, const SenderTemplateObj_t &sender, unsigned int &index)
Definition: RSVP.cc:1947
#define PATH_ERR_NEXTHOP_FAILED
Definition: RSVP.cc:39
virtual void sendPathErrorMessage(PathStateBlock_t *psb, int errCode)
Definition: RSVP.cc:1853
void inet::RSVP::processPathTearMsg ( RSVPPathTear msg)
protectedvirtual
1435 {
1436  EV_INFO << "Received PATH_TEAR" << endl;
1437  //print(msg);
1438 
1439  int lspid = msg->getLspId();
1440 
1441  PathStateBlock_t *psb = findPSB(msg->getSession(), msg->getSenderTemplate());
1442  if (!psb) {
1443  EV_DETAIL << "received PATH_TEAR for nonexisting lspid=" << lspid << endl;
1444  delete msg;
1445  return;
1446  }
1447 
1448  // ignore message if backup exists and force flag is not set
1449 
1450  bool modified = false;
1451 
1452  for (auto it = PSBList.begin(); it != PSBList.end(); it++) {
1453  if (it->OutInterface.getInt() != (uint32)lspid)
1454  continue;
1455 
1456  // merging backup exists
1457 
1458  if (!msg->getForce()) {
1459  EV_DETAIL << "merging backup tunnel exists and force flag is not set, ignoring teardown" << endl;
1460  delete msg;
1461  return;
1462  }
1463 
1464  EV_DETAIL << "merging backup must be removed too" << endl;
1465 
1466  removePSB(&(*it));
1467  --it;
1468 
1469  modified = true;
1470  }
1471 
1472  if (modified)
1473  psb = findPSB(msg->getSession(), msg->getSenderTemplate());
1474 
1475  // forward path teardown downstream
1476 
1477  if (psb->ERO.size() > 0) {
1478  EV_INFO << "forward teardown downstream" << endl;
1479 
1480  sendPathTearMessage(psb->ERO[0].node, psb->Session_Object, psb->Sender_Template_Object,
1481  tedmod->getInterfaceAddrByPeerAddress(psb->ERO[0].node), routerId, msg->getForce());
1482  }
1483 
1484  // remove path state block
1485 
1486  removePSB(psb);
1487 
1488  delete msg;
1489 }
virtual PathStateBlock_t * findPSB(const SessionObj_t &session, const SenderTemplateObj_t &sender)
Definition: RSVP.cc:1966
PSBVector PSBList
Definition: RSVP.h:189
virtual void removePSB(PathStateBlock_t *psb)
Definition: RSVP.cc:1032
virtual void sendPathTearMessage(IPv4Address peerIP, const SessionObj_t &session, const SenderTemplateObj_t &sender, IPv4Address LIH, IPv4Address NHOP, bool force)
Definition: RSVP.cc:1835
IPv4Address routerId
Definition: RSVP.h:187
uint32_t uint32
Definition: Compat.h:30
TED * tedmod
Definition: RSVP.h:175
virtual IPv4Address getInterfaceAddrByPeerAddress(IPv4Address peerIP)
Definition: TED.cc:315
void inet::RSVP::processPSB_TIMEOUT ( PsbTimeoutMsg msg)
protectedvirtual
483 {
484  PathStateBlock_t *psb = findPsbById(msg->getId());
485  ASSERT(psb);
486 
487  if (tedmod->isLocalAddress(psb->OutInterface)) {
488  ASSERT(psb->OutInterface == tedmod->getInterfaceAddrByPeerAddress(psb->ERO[0].node));
489 
490  sendPathTearMessage(psb->ERO[0].node, psb->Session_Object,
491  psb->Sender_Template_Object, psb->OutInterface, routerId, false);
492  }
493 
494  removePSB(psb);
495 }
virtual bool isLocalAddress(IPv4Address addr)
Definition: TED.cc:449
virtual void removePSB(PathStateBlock_t *psb)
Definition: RSVP.cc:1032
virtual void sendPathTearMessage(IPv4Address peerIP, const SessionObj_t &session, const SenderTemplateObj_t &sender, IPv4Address LIH, IPv4Address NHOP, bool force)
Definition: RSVP.cc:1835
virtual PathStateBlock_t * findPsbById(int id)
Definition: RSVP.cc:1975
IPv4Address routerId
Definition: RSVP.h:187
TED * tedmod
Definition: RSVP.h:175
virtual IPv4Address getInterfaceAddrByPeerAddress(IPv4Address peerIP)
Definition: TED.cc:315
void inet::RSVP::processPSB_TIMER ( PsbTimerMsg msg)
protectedvirtual
474 {
475  PathStateBlock_t *psb = findPsbById(msg->getId());
476  ASSERT(psb);
477 
478  refreshPath(psb);
480 }
#define PSB_REFRESH_INTERVAL
Definition: RSVP.cc:31
virtual void scheduleRefreshTimer(PathStateBlock_t *psbEle, simtime_t delay)
Definition: RSVP.cc:1899
virtual PathStateBlock_t * findPsbById(int id)
Definition: RSVP.cc:1975
virtual void refreshPath(PathStateBlock_t *psbEle)
Definition: RSVP.cc:554
void inet::RSVP::processResvMsg ( RSVPResvMsg msg)
protectedvirtual
1551 {
1552  EV_INFO << "Received RESV_MESSAGE" << endl;
1553  print(msg);
1554 
1555  IPv4Address OI = msg->getLIH();
1556 
1557  // find matching PSB for every flow ****************************************
1558 
1559  for (unsigned int m = 0; m < msg->getFlowDescriptor().size(); m++) {
1560  PathStateBlock_t *psb = findPSB(msg->getSession(), (SenderTemplateObj_t&)msg->getFlowDescriptor()[m].Filter_Spec_Object);
1561  if (!psb) {
1562  EV_DETAIL << "matching PSB not found for lspid=" << msg->getFlowDescriptor()[m].Filter_Spec_Object.Lsp_Id << endl;
1563 
1564  // remove descriptor from message
1565  msg->getFlowDescriptor().erase(msg->getFlowDescriptor().begin() + m);
1566  --m;
1567  }
1568  }
1569 
1570  if (msg->getFlowDescriptor().size() == 0) {
1571  EV_INFO << "no matching PSB found" << endl;
1572  delete msg;
1573  return;
1574  }
1575 
1576  // find matching RSB *******************************************************
1577 
1578  ResvStateBlock_t *rsb = nullptr;
1579  for (auto & elem : RSBList) {
1580  if (!(msg->isInSession(&elem.Session_Object)))
1581  continue;
1582 
1583  if (elem.Next_Hop_Address != msg->getNHOP())
1584  continue;
1585 
1586  if (elem.OI != msg->getLIH())
1587  continue;
1588 
1589  rsb = &(elem);
1590  break;
1591  }
1592 
1593  if (!rsb) {
1594  rsb = createRSB(msg);
1595 
1596  scheduleCommitTimer(rsb);
1597 
1598  // reservation is new, propagate upstream immediately
1599  scheduleRefreshTimer(rsb, 0.0);
1600  }
1601  else
1602  updateRSB(rsb, msg);
1603 
1604  scheduleTimeout(rsb);
1605 
1606  delete msg;
1607 }
virtual ResvStateBlock_t * createRSB(RSVPResvMsg *msg)
Definition: RSVP.cc:907
virtual PathStateBlock_t * findPSB(const SessionObj_t &session, const SenderTemplateObj_t &sender)
Definition: RSVP.cc:1966
virtual void scheduleRefreshTimer(PathStateBlock_t *psbEle, simtime_t delay)
Definition: RSVP.cc:1899
virtual void updateRSB(ResvStateBlock_t *rsb, RSVPResvMsg *msg)
Definition: RSVP.cc:942
virtual void scheduleCommitTimer(ResvStateBlock_t *rsbEle)
Definition: RSVP.cc:1937
virtual void print(RSVPPathMsg *p)
Definition: RSVP.cc:2057
RSBVector RSBList
Definition: RSVP.h:190
virtual void scheduleTimeout(PathStateBlock_t *psbEle)
Definition: RSVP.cc:1889
value< double, units::m > m
Definition: Units.h:1047
void inet::RSVP::processRSB_COMMIT_TIMER ( RsbCommitTimerMsg msg)
protectedvirtual
512 {
513  ResvStateBlock_t *rsb = findRsbById(msg->getId());
514  commitResv(rsb);
515 }
virtual ResvStateBlock_t * findRsbById(int id)
Definition: RSVP.cc:1985
virtual void commitResv(ResvStateBlock_t *rsb)
Definition: RSVP.cc:751
void inet::RSVP::processRSB_REFRESH_TIMER ( RsbRefreshTimerMsg msg)
protectedvirtual
498 {
499  ResvStateBlock_t *rsb = findRsbById(msg->getId());
500  if (rsb->commitTimerMsg->isScheduled()) {
501  // reschedule after commit
502  scheduleRefreshTimer(rsb, 0.0);
503  }
504  else {
505  refreshResv(rsb);
506 
508  }
509 }
#define RSB_REFRESH_INTERVAL
Definition: RSVP.cc:32
virtual void refreshResv(ResvStateBlock_t *rsbEle)
Definition: RSVP.cc:589
virtual void scheduleRefreshTimer(PathStateBlock_t *psbEle, simtime_t delay)
Definition: RSVP.cc:1899
virtual ResvStateBlock_t * findRsbById(int id)
Definition: RSVP.cc:1985
void inet::RSVP::processRSB_TIMEOUT ( RsbTimeoutMsg msg)
protectedvirtual
518 {
519  EV_INFO << "RSB TIMEOUT RSB " << msg->getId() << endl;
520 
521  ResvStateBlock_t *rsb = findRsbById(msg->getId());
522 
523  ASSERT(rsb);
524  ASSERT(tedmod->isLocalAddress(rsb->OI));
525 
526  for (unsigned int i = 0; i < rsb->FlowDescriptor.size(); i++) {
527  removeRsbFilter(rsb, 0);
528  }
529  removeRSB(rsb);
530 }
virtual bool isLocalAddress(IPv4Address addr)
Definition: TED.cc:449
virtual ResvStateBlock_t * findRsbById(int id)
Definition: RSVP.cc:1985
TED * tedmod
Definition: RSVP.h:175
virtual void removeRSB(ResvStateBlock_t *rsb)
Definition: RSVP.cc:1003
virtual void removeRsbFilter(ResvStateBlock_t *rsb, unsigned int index)
Definition: RSVP.cc:983
void inet::RSVP::processRSVPMessage ( RSVPMessage msg)
protectedvirtual
1275 {
1276  int kind = msg->getRsvpKind();
1277  switch (kind) {
1278  case PATH_MESSAGE:
1279  processPathMsg(check_and_cast<RSVPPathMsg *>(msg));
1280  break;
1281 
1282  case RESV_MESSAGE:
1283  processResvMsg(check_and_cast<RSVPResvMsg *>(msg));
1284  break;
1285 
1286  case PTEAR_MESSAGE:
1287  processPathTearMsg(check_and_cast<RSVPPathTear *>(msg));
1288  break;
1289 
1290  case HELLO_MESSAGE:
1291  processHelloMsg(check_and_cast<RSVPHelloMsg *>(msg));
1292  break;
1293 
1294  case PERROR_MESSAGE:
1295  processPathErrMsg(check_and_cast<RSVPPathError *>(msg));
1296  break;
1297 
1298  default:
1299  throw cRuntimeError("Invalid RSVP kind of message '%s': %d", msg->getName(), kind);
1300  }
1301 }
#define HELLO_MESSAGE
Definition: RSVPPacket_m.h:39
virtual void processPathMsg(RSVPPathMsg *msg)
Definition: RSVP.cc:1491
#define PTEAR_MESSAGE
Definition: RSVPPacket_m.h:35
virtual void processHelloMsg(RSVPHelloMsg *msg)
Definition: RSVP.cc:1303
#define PATH_MESSAGE
Definition: RSVPPacket_m.h:33
#define RESV_MESSAGE
Definition: RSVPPacket_m.h:34
virtual void processResvMsg(RSVPResvMsg *msg)
Definition: RSVP.cc:1550
virtual void processPathTearMsg(RSVPPathTear *msg)
Definition: RSVP.cc:1434
virtual void processPathErrMsg(RSVPPathError *msg)
Definition: RSVP.cc:1389
#define PERROR_MESSAGE
Definition: RSVPPacket_m.h:37
void inet::RSVP::processSignallingMessage ( SignallingMsg msg)
protectedvirtual
1632 {
1633  int command = msg->getCommand();
1634  switch (command) {
1635  case MSG_PSB_TIMER:
1636  processPSB_TIMER(check_and_cast<PsbTimerMsg *>(msg));
1637  break;
1638 
1639  case MSG_PSB_TIMEOUT:
1640  processPSB_TIMEOUT(check_and_cast<PsbTimeoutMsg *>(msg));
1641  break;
1642 
1643  case MSG_RSB_REFRESH_TIMER:
1644  processRSB_REFRESH_TIMER(check_and_cast<RsbRefreshTimerMsg *>(msg));
1645  break;
1646 
1647  case MSG_RSB_COMMIT_TIMER:
1648  processRSB_COMMIT_TIMER(check_and_cast<RsbCommitTimerMsg *>(msg));
1649  break;
1650 
1651  case MSG_RSB_TIMEOUT:
1652  processRSB_TIMEOUT(check_and_cast<RsbTimeoutMsg *>(msg));
1653  break;
1654 
1655  case MSG_HELLO_TIMER:
1656  processHELLO_TIMER(check_and_cast<HelloTimerMsg *>(msg));
1657  break;
1658 
1659  case MSG_HELLO_TIMEOUT:
1660  processHELLO_TIMEOUT(check_and_cast<HelloTimeoutMsg *>(msg));
1661  break;
1662 
1663  case MSG_PATH_NOTIFY:
1664  processPATH_NOTIFY(check_and_cast<PathNotifyMsg *>(msg));
1665  break;
1666 
1667  default:
1668  throw cRuntimeError("Invalid command %d in message '%s'", command, msg->getName());
1669  }
1670 }
virtual void processRSB_REFRESH_TIMER(RsbRefreshTimerMsg *msg)
Definition: RSVP.cc:497
virtual void processPSB_TIMER(PsbTimerMsg *msg)
Definition: RSVP.cc:473
virtual void processHELLO_TIMER(HelloTimerMsg *msg)
Definition: RSVP.cc:444
#define MSG_PSB_TIMEOUT
Definition: SignallingMsg_m.h:35
virtual void processHELLO_TIMEOUT(HelloTimeoutMsg *msg)
Definition: RSVP.cc:415
#define MSG_RSB_REFRESH_TIMER
Definition: SignallingMsg_m.h:37
virtual void processRSB_TIMEOUT(RsbTimeoutMsg *msg)
Definition: RSVP.cc:517
virtual void processPSB_TIMEOUT(PsbTimeoutMsg *msg)
Definition: RSVP.cc:482
#define MSG_RSB_COMMIT_TIMER
Definition: SignallingMsg_m.h:38
virtual void processPATH_NOTIFY(PathNotifyMsg *msg)
Definition: RSVP.cc:1712
#define MSG_HELLO_TIMER
Definition: SignallingMsg_m.h:41
#define MSG_RSB_TIMEOUT
Definition: SignallingMsg_m.h:39
virtual void processRSB_COMMIT_TIMER(RsbCommitTimerMsg *msg)
Definition: RSVP.cc:511
#define MSG_PSB_TIMER
Definition: SignallingMsg_m.h:34
#define MSG_HELLO_TIMEOUT
Definition: SignallingMsg_m.h:42
#define MSG_PATH_NOTIFY
Definition: SignallingMsg_m.h:44
void inet::RSVP::readTrafficFromXML ( const cXMLElement *  traffic)
protectedvirtual
159 {
160  ASSERT(traffic);
161  ASSERT(!strcmp(traffic->getTagName(), "sessions"));
162  checkTags(traffic, "session");
163  cXMLElementList list = traffic->getChildrenByTagName("session");
164  for (auto & elem : list)
166 }
virtual void readTrafficSessionFromXML(const cXMLElement *session)
Definition: RSVP.cc:193
std::vector< traffic_session_t > traffic
Definition: RSVP.h:66
void checkTags(const cXMLElement *node, const char *allowed)
Definition: XMLUtils.cc:54
EroVector inet::RSVP::readTrafficRouteFromXML ( const cXMLElement *  route)
protectedvirtual
169 {
170  checkTags(route, "node lnode");
171 
172  EroVector ERO;
173 
174  for (cXMLElement *hop = route->getFirstChild(); hop; hop = hop->getNextSibling()) {
175  EroObj_t h;
176  if (!strcmp(hop->getTagName(), "node")) {
177  h.L = false;
178  h.node = L3AddressResolver().resolve(hop->getNodeValue()).toIPv4();
179  }
180  else if (!strcmp(hop->getTagName(), "lnode")) {
181  h.L = true;
182  h.node = L3AddressResolver().resolve(hop->getNodeValue()).toIPv4();
183  }
184  else {
185  ASSERT(false);
186  }
187  ERO.push_back(h);
188  }
189 
190  return ERO;
191 }
void checkTags(const cXMLElement *node, const char *allowed)
Definition: XMLUtils.cc:54
std::vector< struct EroObj_t > EroVector
Definition: IntServ_m.h:39
const value< double, compose< units::J, units::s > > h(6.62606896e-34)
void inet::RSVP::readTrafficSessionFromXML ( const cXMLElement *  session)
protectedvirtual
194 {
195  checkTags(session, "tunnel_id endpoint setup_pri holding_pri paths");
196 
197  traffic_session_t newSession;
198 
199  newSession.sobj.Tunnel_Id = getParameterIntValue(session, "tunnel_id");
200  newSession.sobj.Extended_Tunnel_Id = routerId.getInt();
201  newSession.sobj.DestAddress = getParameterIPAddressValue(session, "endpoint");
202 
203  auto sit = findSession(newSession.sobj);
204 
205  bool merge;
206 
207  if (sit != traffic.end()) {
208  // session already exits, add new paths
209 
210  merge = true;
211 
212  ASSERT(!getUniqueChildIfExists(session, "holding_pri") || getParameterIntValue(session, "holding_pri") == sit->sobj.holdingPri);
213  ASSERT(!getUniqueChildIfExists(session, "setup_pri") || getParameterIntValue(session, "setup_pri") == sit->sobj.setupPri);
214 
215  newSession.sobj.setupPri = sit->sobj.setupPri;
216  newSession.sobj.holdingPri = sit->sobj.holdingPri;
217 
218  sit->sobj = newSession.sobj;
219  }
220  else {
221  // session not found, create new
222 
223  merge = false;
224 
225  newSession.sobj.setupPri = getParameterIntValue(session, "setup_pri", 7);
226  newSession.sobj.holdingPri = getParameterIntValue(session, "holding_pri", 7);
227  }
228 
229  const cXMLElement *paths = getUniqueChild(session, "paths");
230  checkTags(paths, "path");
231 
232  cXMLElementList list = paths->getChildrenByTagName("path");
233  for (auto path : list) {
234 
235  checkTags(path, "sender lspid bandwidth max_delay route permanent owner color");
236 
237  int lspid = getParameterIntValue(path, "lspid");
238  ;
239 
240  std::vector<traffic_path_t>::iterator pit;
241 
242  traffic_path_t newPath;
243 
244  newPath.sender.SrcAddress = getParameterIPAddressValue(path, "sender", routerId);
245  newPath.sender.Lsp_Id = lspid;
246 
247  // make sure path doesn't exist yet
248 
249  if (merge) {
250  pit = findPath(&(*sit), newPath.sender);
251  if (pit != sit->paths.end()) {
252  EV_DETAIL << "path " << lspid << " already exists in this session, doing nothing" << endl;
253  continue;
254  }
255  }
256  else {
257  pit = findPath(&newSession, newPath.sender);
258  if (pit != newSession.paths.end()) {
259  EV_INFO << "path " << lspid << " already exists in this session, doing nothing" << endl;
260  continue;
261  }
262  }
263 
264  const char *str = getParameterStrValue(path, "owner", "");
265  if (strlen(str)) {
266  cModule *mod = getModuleByPath(str);
267  newPath.owner = mod->getId();
268  }
269  else {
270  newPath.owner = getId();
271  }
272 
273  newPath.permanent = getParameterBoolValue(path, "permanent", true);
274  newPath.color = getParameterIntValue(path, "color", 0);
275 
276  newPath.tspec.req_bandwidth = getParameterDoubleValue(path, "bandwidth", 0.0);
277  newPath.max_delay = getParameterDoubleValue(path, "max_delay", 0.0);
278 
279  const cXMLElement *route = getUniqueChildIfExists(path, "route");
280  if (route)
281  newPath.ERO = readTrafficRouteFromXML(route);
282 
283  if (merge) {
284  EV_INFO << "adding new path into an existing session" << endl;
285 
286  sit->paths.push_back(newPath);
287  }
288  else {
289  EV_INFO << "adding new path into new session" << endl;
290 
291  newSession.paths.push_back(newPath);
292  }
293 
294  // schedule path creation
295 
296  sendPathNotify(getId(), newSession.sobj, newPath.sender, PATH_RETRY, 0.0);
297  }
298 
299  if (!merge) {
300  EV_INFO << "adding new session into database" << endl;
301 
302  traffic.push_back(newSession);
303  }
304 }
std::vector< traffic_path_t >::iterator findPath(traffic_session_t *session, const SenderTemplateObj_t &sender)
Definition: RSVP.cc:306
double mod(double dividend, double divisor)
Returns the rest of a whole-numbered division.
Definition: INETMath.h:108
IPv4Address getParameterIPAddressValue(const cXMLElement *ptr, const char *name, IPv4Address def)
Definition: XMLUtils.cc:120
std::vector< traffic_session_t > traffic
Definition: RSVP.h:66
virtual void sendPathNotify(int handler, const SessionObj_t &session, const SenderTemplateObj_t &sender, int status, simtime_t delay)
Definition: RSVP.cc:393
#define PATH_RETRY
Definition: SignallingMsg_m.h:50
const cXMLElement * getUniqueChild(const cXMLElement *node, const char *name)
Definition: XMLUtils.cc:8
const char * getParameterStrValue(const cXMLElement *ptr, const char *name, const char *def)
Definition: XMLUtils.cc:75
void checkTags(const cXMLElement *node, const char *allowed)
Definition: XMLUtils.cc:54
std::vector< traffic_session_t >::iterator findSession(const SessionObj_t &session)
Definition: RSVP.cc:1741
IPv4Address routerId
Definition: RSVP.h:187
uint32 getInt() const
Returns the address as an int.
Definition: IPv4Address.h:197
int getParameterIntValue(const cXMLElement *ptr, const char *name, int def)
Definition: XMLUtils.cc:105
double getParameterDoubleValue(const cXMLElement *ptr, const char *name, double def)
Definition: XMLUtils.cc:135
bool getParameterBoolValue(const cXMLElement *ptr, const char *name, bool def)
Definition: XMLUtils.cc:84
const cXMLElement * getUniqueChildIfExists(const cXMLElement *node, const char *name)
Definition: XMLUtils.cc:17
virtual EroVector readTrafficRouteFromXML(const cXMLElement *route)
Definition: RSVP.cc:168
void inet::RSVP::recoveryEvent ( IPv4Address  peer)
protectedvirtual
1610 {
1611  // called when peer's operation is restored
1612 
1613  unsigned int index = tedmod->linkIndex(routerId, peer);
1614  bool rtmodified = !tedmod->ted[index].state;
1615  tedmod->ted[index].state = true;
1616  announceLinkChange(index);
1617 
1618  // rebuild routing table if link state changed
1619  if (rtmodified)
1621 
1622  // refresh all paths towards this neighbour
1623  for (auto & elem : PSBList) {
1624  if (elem.OutInterface != tedmod->ted[index].local)
1625  continue;
1626 
1627  scheduleRefreshTimer(&(elem), 0.0);
1628  }
1629 }
virtual unsigned int linkIndex(IPv4Address localInf)
Definition: TED.cc:429
virtual void rebuildRoutingTable()
Definition: TED.cc:230
virtual void scheduleRefreshTimer(PathStateBlock_t *psbEle, simtime_t delay)
Definition: RSVP.cc:1899
PSBVector PSBList
Definition: RSVP.h:189
virtual void announceLinkChange(int tedlinkindex)
Definition: RSVP.cc:743
IPv4Address routerId
Definition: RSVP.h:187
TELinkStateInfoVector ted
The link state database.
Definition: TED.h:64
TED * tedmod
Definition: RSVP.h:175
void inet::RSVP::refreshPath ( PathStateBlock_t psbEle)
protectedvirtual
555 {
556  EV_INFO << "refresh path (PSB " << psbEle->id << ")" << endl;
557 
558  IPv4Address& OI = psbEle->OutInterface;
559  EroVector& ERO = psbEle->ERO;
560 
561  ASSERT(!OI.isUnspecified());
562  ASSERT(tedmod->isLocalAddress(OI));
563 
564  RSVPPathMsg *pm = new RSVPPathMsg("Path");
565 
566  pm->setSession(psbEle->Session_Object);
567  pm->setSenderTemplate(psbEle->Sender_Template_Object);
568  pm->setSenderTspec(psbEle->Sender_Tspec_Object);
569 
570  RsvpHopObj_t hop;
571  hop.Logical_Interface_Handle = OI;
572  hop.Next_Hop_Address = routerId;
573  pm->setHop(hop);
574 
575  pm->setERO(ERO);
576  pm->setColor(psbEle->color);
577 
578  int length = 85 + (ERO.size() * 5);
579 
580  pm->setByteLength(length);
581 
582  IPv4Address nextHop = tedmod->getPeerByLocalAddress(OI);
583 
584  ASSERT(ERO.size() == 0 || ERO[0].node.equals(nextHop) || ERO[0].L);
585 
586  sendToIP(pm, nextHop);
587 }
virtual bool isLocalAddress(IPv4Address addr)
Definition: TED.cc:449
virtual void sendToIP(cMessage *msg, IPv4Address destAddr)
Definition: RSVP.cc:1877
virtual IPv4Address getPeerByLocalAddress(IPv4Address localInf)
Definition: TED.cc:484
std::vector< struct EroObj_t > EroVector
Definition: IntServ_m.h:39
IPv4Address routerId
Definition: RSVP.h:187
TED * tedmod
Definition: RSVP.h:175
void inet::RSVP::refreshResv ( ResvStateBlock_t rsbEle)
protectedvirtual
590 {
591  EV_INFO << "refresh reservation (RSB " << rsbEle->id << ")" << endl;
592 
593  IPAddressVector phops;
594 
595  for (auto & elem : PSBList) {
596  if (elem.OutInterface != rsbEle->OI)
597  continue;
598 
599  for (auto & _i : rsbEle->FlowDescriptor) {
600  if ((FilterSpecObj_t&)elem.Sender_Template_Object != _i.Filter_Spec_Object)
601  continue;
602 
603  if (tedmod->isLocalAddress(elem.Previous_Hop_Address))
604  continue; // IR nothing to refresh
605 
606  if (!find(phops, elem.Previous_Hop_Address))
607  phops.push_back(elem.Previous_Hop_Address);
608  }
609 
610  for (auto & phop : phops)
611  refreshResv(rsbEle, phop);
612  }
613 }
virtual bool isLocalAddress(IPv4Address addr)
Definition: TED.cc:449
virtual void refreshResv(ResvStateBlock_t *rsbEle)
Definition: RSVP.cc:589
PSBVector PSBList
Definition: RSVP.h:189
std::vector< IPv4Address > IPAddressVector
Definition: IntServ_m.h:38
TED * tedmod
Definition: RSVP.h:175
std::vector< T >::iterator find(std::vector< T > &v, const T &a)
Definition: stlutils.h:48
void inet::RSVP::refreshResv ( ResvStateBlock_t rsbEle,
IPv4Address  PHOP 
)
protectedvirtual
616 {
617  EV_INFO << "refresh reservation (RSB " << rsbEle->id << ") PHOP " << PHOP << endl;
618 
619  RSVPResvMsg *msg = new RSVPResvMsg(" Resv");
620 
621  FlowDescriptorVector flows;
622 
623  msg->setSession(rsbEle->Session_Object);
624 
625  RsvpHopObj_t hop;
626  hop.Logical_Interface_Handle = tedmod->peerRemoteInterface(PHOP);
627  hop.Next_Hop_Address = PHOP;
628  msg->setHop(hop);
629 
630  for (auto & elem : PSBList) {
631  if (elem.Previous_Hop_Address != PHOP)
632  continue;
633 
634  //if (it->LIH != LIH)
635  // continue;
636 
637  if (elem.Session_Object != rsbEle->Session_Object)
638  continue;
639 
640  for (unsigned int c = 0; c < rsbEle->FlowDescriptor.size(); c++) {
641  if ((FilterSpecObj_t&)elem.Sender_Template_Object != rsbEle->FlowDescriptor[c].Filter_Spec_Object)
642  continue;
643 
644  ASSERT(rsbEle->inLabelVector.size() == rsbEle->FlowDescriptor.size());
645 
646  FlowDescriptor_t flow;
647  flow.Filter_Spec_Object = (FilterSpecObj_t&)elem.Sender_Template_Object;
648  flow.Flowspec_Object = (FlowSpecObj_t&)elem.Sender_Tspec_Object;
649  flow.RRO = rsbEle->FlowDescriptor[c].RRO;
650  flow.RRO.push_back(routerId);
651  flow.label = rsbEle->inLabelVector[c];
652  flows.push_back(flow);
653 
654  break;
655  }
656  }
657 
658  msg->setFlowDescriptor(flows);
659 
660  int fd_length = 0;
661  for (auto & flow : flows)
662  fd_length += 28 + (flow.RRO.size() * 4);
663 
664  int length = 34 + fd_length;
665 
666  // see comment elsewhere (in TED.cc)
667  length /= 10;
668 
669  msg->setByteLength(length);
670 
671  sendToIP(msg, PHOP);
672 }
std::vector< struct FlowDescriptor_t > FlowDescriptorVector
Definition: IntServ_m.h:40
virtual void sendToIP(cMessage *msg, IPv4Address destAddr)
Definition: RSVP.cc:1877
PSBVector PSBList
Definition: RSVP.h:189
const value< double, compose< units::m, pow< units::s,-1 > > > c(299792458)
IPv4Address routerId
Definition: RSVP.h:187
TED * tedmod
Definition: RSVP.h:175
uint32_t flow
Definition: TCP_NSC.cc:75
virtual IPv4Address peerRemoteInterface(IPv4Address peerIP)
Definition: TED.cc:324
void inet::RSVP::removeHello ( HelloState_t h)
protectedvirtual
377 {
378  cancelEvent(h->timeout);
379  cancelEvent(h->timer);
380 
381  delete h->timeout;
382  delete h->timer;
383 
384  for (auto it = HelloList.begin(); it != HelloList.end(); it++) {
385  if (it->peer == h->peer) {
386  HelloList.erase(it);
387  return;
388  }
389  }
390  ASSERT(false);
391 }
HelloVector HelloList
Definition: RSVP.h:191
const value< double, compose< units::J, units::s > > h(6.62606896e-34)
void inet::RSVP::removePSB ( PathStateBlock_t psb)
protectedvirtual
1033 {
1034  ASSERT(psb);
1035 
1036  int lspid = psb->Sender_Template_Object.Lsp_Id;
1037 
1038  EV_INFO << "removing PSB " << psb->id << " (lspid " << lspid << ")" << endl;
1039 
1040  // remove reservation state if exists **************************************
1041 
1042  unsigned int filterIndex;
1043  ResvStateBlock_t *rsb = findRSB(psb->Session_Object, psb->Sender_Template_Object, filterIndex);
1044  if (rsb) {
1045  EV_INFO << "reservation state present, will be removed too" << endl;
1046 
1047  removeRsbFilter(rsb, filterIndex);
1048  }
1049 
1050  // proceed with actual removal *********************************************
1051 
1052  cancelAndDelete(psb->timerMsg);
1053  cancelAndDelete(psb->timeoutMsg);
1054 
1055  for (auto it = PSBList.begin(); it != PSBList.end(); it++) {
1056  if (it->id == psb->id) {
1057  PSBList.erase(it);
1058  return;
1059  }
1060  }
1061  ASSERT(false);
1062 }
PSBVector PSBList
Definition: RSVP.h:189
virtual ResvStateBlock_t * findRSB(const SessionObj_t &session, const SenderTemplateObj_t &sender, unsigned int &index)
Definition: RSVP.cc:1947
virtual void removeRsbFilter(ResvStateBlock_t *rsb, unsigned int index)
Definition: RSVP.cc:983
void inet::RSVP::removeRSB ( ResvStateBlock_t rsb)
protectedvirtual
1004 {
1005  ASSERT(rsb);
1006  ASSERT(rsb->FlowDescriptor.size() == 0);
1007 
1008  EV_INFO << "removing empty RSB " << rsb->id << endl;
1009 
1010  cancelEvent(rsb->refreshTimerMsg);
1011  cancelEvent(rsb->commitTimerMsg);
1012  cancelEvent(rsb->timeoutMsg);
1013 
1014  delete rsb->refreshTimerMsg;
1015  delete rsb->commitTimerMsg;
1016  delete rsb->timeoutMsg;
1017 
1018  if (rsb->Flowspec_Object.req_bandwidth > 0) {
1019  // deallocate resources
1020  allocateResource(rsb->OI, rsb->Session_Object, -rsb->Flowspec_Object.req_bandwidth);
1021  }
1022 
1023  for (auto it = RSBList.begin(); it != RSBList.end(); it++) {
1024  if (it->id == rsb->id) {
1025  RSBList.erase(it);
1026  return;
1027  }
1028  }
1029  ASSERT(false);
1030 }
RSBVector RSBList
Definition: RSVP.h:190
virtual bool allocateResource(IPv4Address OI, const SessionObj_t &session, double bandwidth)
Definition: RSVP.cc:707
void inet::RSVP::removeRsbFilter ( ResvStateBlock_t rsb,
unsigned int  index 
)
protectedvirtual
984 {
985  ASSERT(rsb);
986  ASSERT(index < rsb->FlowDescriptor.size());
987  ASSERT(rsb->inLabelVector.size() == rsb->FlowDescriptor.size());
988 
989  int lspid = rsb->FlowDescriptor[index].Filter_Spec_Object.Lsp_Id;
990  int inLabel = rsb->inLabelVector[index];
991 
992  EV_INFO << "removing filter (lspid=" << lspid << ")" << endl;
993 
994  if (inLabel != -1)
995  lt->removeLibEntry(inLabel);
996 
997  rsb->FlowDescriptor.erase(rsb->FlowDescriptor.begin() + index);
998  rsb->inLabelVector.erase(rsb->inLabelVector.begin() + index);
999 
1000  scheduleCommitTimer(rsb);
1001 }
LIBTable * lt
Definition: RSVP.h:178
virtual void removeLibEntry(int inLabel)
Definition: LIBTable.cc:93
virtual void scheduleCommitTimer(ResvStateBlock_t *rsbEle)
Definition: RSVP.cc:1937
void inet::RSVP::scheduleCommitTimer ( ResvStateBlock_t rsbEle)
protectedvirtual
1938 {
1939  ASSERT(rsbEle);
1940 
1941  if (rsbEle->commitTimerMsg->isScheduled())
1942  cancelEvent(rsbEle->commitTimerMsg);
1943 
1944  scheduleAt(simTime(), rsbEle->commitTimerMsg);
1945 }
void inet::RSVP::scheduleRefreshTimer ( PathStateBlock_t psbEle,
simtime_t  delay 
)
protectedvirtual
1900 {
1901  ASSERT(psbEle);
1902 
1903  if (psbEle->OutInterface.isUnspecified())
1904  return;
1905 
1906  if (!tedmod->isLocalAddress(psbEle->OutInterface))
1907  return;
1908 
1909  if (psbEle->timerMsg->isScheduled())
1910  cancelEvent(psbEle->timerMsg);
1911 
1912  EV_DETAIL << "scheduling PSB " << psbEle->id << " refresh " << (simTime() + delay) << endl;
1913 
1914  scheduleAt(simTime() + delay, psbEle->timerMsg);
1915 }
virtual bool isLocalAddress(IPv4Address addr)
Definition: TED.cc:449
TED * tedmod
Definition: RSVP.h:175
void inet::RSVP::scheduleRefreshTimer ( ResvStateBlock_t rsbEle,
simtime_t  delay 
)
protectedvirtual
1928 {
1929  ASSERT(rsbEle);
1930 
1931  if (rsbEle->refreshTimerMsg->isScheduled())
1932  cancelEvent(rsbEle->refreshTimerMsg);
1933 
1934  scheduleAt(simTime() + delay, rsbEle->refreshTimerMsg);
1935 }
void inet::RSVP::scheduleTimeout ( PathStateBlock_t psbEle)
protectedvirtual
1890 {
1891  ASSERT(psbEle);
1892 
1893  if (psbEle->timeoutMsg->isScheduled())
1894  cancelEvent(psbEle->timeoutMsg);
1895 
1896  scheduleAt(simTime() + PSB_TIMEOUT_INTERVAL, psbEle->timeoutMsg);
1897 }
#define PSB_TIMEOUT_INTERVAL
Definition: RSVP.cc:34
void inet::RSVP::scheduleTimeout ( ResvStateBlock_t rsbEle)
protectedvirtual
1918 {
1919  ASSERT(rsbEle);
1920 
1921  if (rsbEle->timeoutMsg->isScheduled())
1922  cancelEvent(rsbEle->timeoutMsg);
1923 
1924  scheduleAt(simTime() + RSB_TIMEOUT_INTERVAL, rsbEle->timeoutMsg);
1925 }
#define RSB_TIMEOUT_INTERVAL
Definition: RSVP.cc:35
void inet::RSVP::sendPathErrorMessage ( PathStateBlock_t psb,
int  errCode 
)
protectedvirtual
1854 {
1855  sendPathErrorMessage(psb->Session_Object, psb->Sender_Template_Object, psb->Sender_Tspec_Object, psb->Previous_Hop_Address, errCode);
1856 }
virtual void sendPathErrorMessage(PathStateBlock_t *psb, int errCode)
Definition: RSVP.cc:1853
void inet::RSVP::sendPathErrorMessage ( SessionObj_t  session,
SenderTemplateObj_t  sender,
SenderTspecObj_t  tspec,
IPv4Address  nextHop,
int  errCode 
)
protectedvirtual
1859 {
1860  RSVPPathError *msg = new RSVPPathError("PathErr");
1861  msg->setErrorCode(errCode);
1862  msg->setErrorNode(routerId);
1863  msg->setSession(session);
1864  msg->setSenderTemplate(sender);
1865  msg->setSenderTspec(tspec);
1866 
1867  int length = 52;
1868 
1869  // see comment elsewhere (in TED.cc)
1870  length /= 10;
1871 
1872  msg->setByteLength(length);
1873 
1874  sendToIP(msg, nextHop);
1875 }
virtual void sendToIP(cMessage *msg, IPv4Address destAddr)
Definition: RSVP.cc:1877
IPv4Address routerId
Definition: RSVP.h:187
void inet::RSVP::sendPathNotify ( int  handler,
const SessionObj_t session,
const SenderTemplateObj_t sender,
int  status,
simtime_t  delay 
)
protectedvirtual
394 {
395  if (handler < 0)
396  return; // handler not specified
397 
398  cModule *mod = getSimulation()->getModule(handler);
399 
400  if (!mod)
401  return; // handler no longer exists
402 
403  PathNotifyMsg *msg = new PathNotifyMsg("path notify");
404 
405  msg->setSession(session);
406  msg->setSender(sender);
407  msg->setStatus(status);
408 
409  if (handler == getId())
410  scheduleAt(simTime() + delay, msg);
411  else
412  sendDirect(msg, delay, 0, mod, "from_rsvp");
413 }
double mod(double dividend, double divisor)
Returns the rest of a whole-numbered division.
Definition: INETMath.h:108
void inet::RSVP::sendPathTearMessage ( IPv4Address  peerIP,
const SessionObj_t session,
const SenderTemplateObj_t sender,
IPv4Address  LIH,
IPv4Address  NHOP,
bool  force 
)
protectedvirtual
1836 {
1837  RSVPPathTear *msg = new RSVPPathTear("PathTear");
1838  msg->setSenderTemplate(sender);
1839  msg->setSession(session);
1840  RsvpHopObj_t hop;
1841  hop.Logical_Interface_Handle = LIH;
1842  hop.Next_Hop_Address = NHOP;
1843  msg->setHop(hop);
1844  msg->setForce(force);
1845 
1846  int length = 44;
1847 
1848  msg->setByteLength(length);
1849 
1850  sendToIP(msg, peerIP);
1851 }
virtual void sendToIP(cMessage *msg, IPv4Address destAddr)
Definition: RSVP.cc:1877
void inet::RSVP::sendToIP ( cMessage *  msg,
IPv4Address  destAddr 
)
protectedvirtual
1878 {
1879  IPv4ControlInfo *controlInfo = new IPv4ControlInfo();
1880  controlInfo->setDestAddr(destAddr);
1881  controlInfo->setProtocol(IP_PROT_RSVP);
1882  msg->setControlInfo(controlInfo);
1883 
1884  msg->addPar("color") = RSVP_TRAFFIC;
1885 
1886  send(msg, "ipOut");
1887 }
#define RSVP_TRAFFIC
Definition: RSVPPacket.h:23
Definition: IPProtocolId_m.h:86
void inet::RSVP::setupHello ( )
protectedvirtual
317 {
318  helloInterval = par("helloInterval").doubleValue();
319  helloTimeout = par("helloTimeout").doubleValue();
320 
321  cStringTokenizer tokenizer(par("peers"));
322  const char *token;
323  while ((token = tokenizer.nextToken()) != nullptr) {
324  ASSERT(ift->getInterfaceByName(token));
325 
326  IPv4Address peer = tedmod->getPeerByLocalAddress(ift->getInterfaceByName(token)->ipv4Data()->getIPAddress());
327 
328  HelloState_t h;
329 
330  h.timer = new HelloTimerMsg("hello timer");
331  h.timer->setPeer(peer);
332 
333  h.timeout = new HelloTimeoutMsg("hello timeout");
334  h.timeout->setPeer(peer);
335 
336  h.peer = peer;
337 
338  if (helloInterval > 0.0) {
339  // peer is down until we know he is ok
340 
341  h.ok = false;
342  }
343  else {
344  // don't use HELLO at all, consider all peers running all the time
345 
346  h.ok = true;
347  }
348 
349  HelloList.push_back(h);
350 
351  if (helloInterval > 0.0) {
352  startHello(peer, exponential(helloInterval));
353  }
354  }
355 }
IPv4InterfaceData * ipv4Data() const
Definition: InterfaceEntry.h:221
simtime_t helloTimeout
Definition: RSVP.h:171
virtual InterfaceEntry * getInterfaceByName(const char *name) const =0
Returns an interface given by its name.
IInterfaceTable * ift
Definition: RSVP.h:177
virtual IPv4Address getPeerByLocalAddress(IPv4Address localInf)
Definition: TED.cc:484
simtime_t helloInterval
Definition: RSVP.h:170
IPv4Address getIPAddress() const
Definition: IPv4InterfaceData.h:177
TED * tedmod
Definition: RSVP.h:175
virtual void startHello(IPv4Address peer, simtime_t delay)
Definition: RSVP.cc:357
HelloVector HelloList
Definition: RSVP.h:191
const value< double, compose< units::J, units::s > > h(6.62606896e-34)
void inet::RSVP::startHello ( IPv4Address  peer,
simtime_t  delay 
)
protectedvirtual
358 {
359  EV_INFO << "scheduling hello start in " << delay << " seconds" << endl;
360 
361  HelloState_t *h = findHello(peer);
362  ASSERT(h);
363 
364  ASSERT(!h->timer->isScheduled());
365  ASSERT(!h->timeout->isScheduled());
366  ASSERT(!h->ok);
367 
368  h->srcInstance = ++maxSrcInstance;
369  h->dstInstance = 0;
370  h->request = true;
371  h->ack = false;
372 
373  scheduleAt(simTime() + delay, h->timer);
374 }
int maxSrcInstance
Definition: RSVP.h:185
const value< double, compose< units::J, units::s > > h(6.62606896e-34)
virtual HelloState_t * findHello(IPv4Address peer)
Definition: RSVP.cc:1995
void inet::RSVP::updateRSB ( ResvStateBlock_t rsb,
RSVPResvMsg msg 
)
protectedvirtual
943 {
944  ASSERT(rsb);
945 
946  for (auto & elem : msg->getFlowDescriptor()) {
947  FlowDescriptor_t flow = elem;
948 
949  unsigned int m;
950  for (m = 0; m < rsb->FlowDescriptor.size(); m++) {
951  if (rsb->FlowDescriptor[m].Filter_Spec_Object == flow.Filter_Spec_Object) {
952  // sender found
953  EV_DETAIL << "sender (lspid=" << flow.Filter_Spec_Object.Lsp_Id << ") found in RSB" << endl;
954 
955  if (rsb->FlowDescriptor[m].label != flow.label) {
956  EV_DETAIL << "label modified (new label=" << flow.label << ")" << endl;
957 
958  rsb->FlowDescriptor[m].label = flow.label;
959 
960  // label must be updated in lib table
961 
962  scheduleCommitTimer(rsb);
963  }
964 
965  break;
966  }
967  }
968  if (m == rsb->FlowDescriptor.size()) {
969  // sender not found
970  EV_INFO << "sender (lspid=" << flow.Filter_Spec_Object.Lsp_Id << ") not found in RSB, adding..." << endl;
971 
972  rsb->FlowDescriptor.push_back(flow);
973  rsb->inLabelVector.push_back(-1);
974 
975  // resv is new and must be forwarded
976 
977  scheduleCommitTimer(rsb);
978  scheduleRefreshTimer(rsb, 0.0);
979  }
980  }
981 }
virtual void scheduleRefreshTimer(PathStateBlock_t *psbEle, simtime_t delay)
Definition: RSVP.cc:1899
virtual void scheduleCommitTimer(ResvStateBlock_t *rsbEle)
Definition: RSVP.cc:1937
uint32_t flow
Definition: TCP_NSC.cc:75
value< double, units::m > m
Definition: Units.h:1047

Friends And Related Function Documentation

friend class SimpleClassifier
friend

Member Data Documentation

simtime_t inet::RSVP::helloInterval
protected
HelloVector inet::RSVP::HelloList
protected
simtime_t inet::RSVP::helloTimeout
protected
IInterfaceTable* inet::RSVP::ift = nullptr
protected
LIBTable* inet::RSVP::lt = nullptr
protected
int inet::RSVP::maxPsbId = 0
protected
int inet::RSVP::maxRsbId = 0
protected
int inet::RSVP::maxSrcInstance = 0
protected
PSBVector inet::RSVP::PSBList
protected
simtime_t inet::RSVP::retryInterval
protected
IPv4Address inet::RSVP::routerId
protected
IRSVPClassifier* inet::RSVP::rpct = nullptr
protected
RSBVector inet::RSVP::RSBList
protected
IIPv4RoutingTable* inet::RSVP::rt = nullptr
protected
TED* inet::RSVP::tedmod = nullptr
protected
std::vector<traffic_session_t> inet::RSVP::traffic
protected

The documentation for this class was generated from the following files: