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

LDP (rfc 3036) protocol implementation. More...

#include <Ldp.h>

Inheritance diagram for inet::Ldp:
inet::RoutingProtocolBase inet::TcpSocket::ReceiveQueueBasedCallback inet::UdpSocket::ICallback inet::IIngressClassifier inet::OperationalBase inet::TcpSocket::ICallback inet::OperationalMixin< cSimpleModule > inet::ILifecycle

Classes

struct  fec_bind_t
 
struct  fec_t
 
struct  peer_info
 
struct  pending_req_t
 

Public Types

typedef std::vector< fec_tFecVector
 
typedef std::vector< fec_bind_tFecBindVector
 
typedef std::vector< pending_req_tPendingVector
 
typedef std::vector< peer_infoPeerVector
 

Public Member Functions

 Ldp ()
 
virtual ~Ldp ()
 
virtual void handleStartOperation (LifecycleOperation *operation) override
 
virtual void handleStopOperation (LifecycleOperation *operation) override
 
virtual void handleCrashOperation (LifecycleOperation *operation) override
 
- Public Member Functions inherited from inet::RoutingProtocolBase
 RoutingProtocolBase ()
 
- Public Member Functions inherited from inet::OperationalMixin< cSimpleModule >
virtual ~OperationalMixin ()
 }@ More...
 
- Public Member Functions inherited from inet::ILifecycle
virtual ~ILifecycle ()
 
- Public Member Functions inherited from inet::TcpSocket::ReceiveQueueBasedCallback
virtual void socketDataArrived (TcpSocket *socket, Packet *packet, bool urgent) override
 Notifies about data arrival, packet ownership is transferred to the callee. More...
 
- Public Member Functions inherited from inet::TcpSocket::ICallback
virtual ~ICallback ()
 
- Public Member Functions inherited from inet::UdpSocket::ICallback
virtual ~ICallback ()
 
- Public Member Functions inherited from inet::IIngressClassifier
virtual ~IIngressClassifier ()
 

Protected Member Functions

virtual Ipv4Address locateNextHop (Ipv4Address dest)
 This method finds next peer in upstream direction. More...
 
virtual Ipv4Address findPeerAddrFromInterface (std::string interfaceName)
 This method maps the peerIP with the interface name in routing table. More...
 
std::string findInterfaceFromPeerAddr (Ipv4Address peerIP)
 
virtual int findPeer (Ipv4Address peerAddr)
 Utility: return peer's index in myPeers table, or -1 if not found. More...
 
virtual TcpSocketgetPeerSocket (Ipv4Address peerAddr)
 Utility: return socket for given peer. More...
 
virtual TcpSocketfindPeerSocket (Ipv4Address peerAddr)
 Utility: return socket for given peer, and nullptr if session doesn't exist. More...
 
virtual void sendToPeer (Ipv4Address dest, Packet *msg)
 
FecVector::iterator findFecEntry (FecVector &fecs, Ipv4Address addr, int length)
 
FecBindVector::iterator findFecEntry (FecBindVector &fecs, int fecid, Ipv4Address peer)
 
virtual void sendMappingRequest (Ipv4Address dest, Ipv4Address addr, int length)
 
virtual void sendMapping (int type, Ipv4Address dest, int label, Ipv4Address addr, int length)
 
virtual void sendNotify (int status, Ipv4Address dest, Ipv4Address addr, int length)
 
virtual void rebuildFecList ()
 
virtual void updateFecList (Ipv4Address nextHop)
 
virtual void updateFecListEntry (fec_t oldItem)
 
virtual void announceLinkChange (int tedlinkindex)
 
virtual int numInitStages () const override
 
virtual void initialize (int stage) override
 
virtual void handleMessageWhenUp (cMessage *msg) override
 
virtual void sendHelloTo (Ipv4Address dest)
 
virtual void openTCPConnectionToPeer (int peerIndex)
 
virtual void processLDPHello (Packet *msg)
 
virtual void processHelloTimeout (cMessage *msg)
 
virtual void processLdpPacketFromTcp (Ptr< const LdpPacket > &ldpPacket)
 
virtual void processLABEL_MAPPING (Ptr< const LdpPacket > &ldpPacket)
 
virtual void processLABEL_REQUEST (Ptr< const LdpPacket > &ldpPacket)
 
virtual void processLABEL_RELEASE (Ptr< const LdpPacket > &ldpPacket)
 
virtual void processLABEL_WITHDRAW (Ptr< const LdpPacket > &ldpPacket)
 
virtual void processNOTIFICATION (Ptr< const LdpPacket > &ldpPacket, bool rescheduled)
 
TcpSocket::ICallback callback methods
virtual void socketDataArrived (TcpSocket *socket) override
 
virtual void socketAvailable (TcpSocket *socket, TcpAvailableInfo *availableInfo) override
 
virtual void socketEstablished (TcpSocket *socket) override
 
virtual void socketPeerClosed (TcpSocket *socket) override
 
virtual void socketClosed (TcpSocket *socket) override
 
virtual void socketFailure (TcpSocket *socket, int code) override
 
virtual void socketStatusArrived (TcpSocket *socket, TcpStatusInfo *status) override
 
virtual void socketDeleted (TcpSocket *socket) override
 
UdpSocket::ICallback methods
virtual void socketDataArrived (UdpSocket *socket, Packet *packet) override
 Notifies about data arrival, packet ownership is transferred to the callee. More...
 
virtual void socketErrorArrived (UdpSocket *socket, Indication *indication) override
 Notifies about error indication arrival, indication ownership is transferred to the callee. More...
 
virtual void socketClosed (UdpSocket *socket) override
 Notifies about socket closed, indication ownership is transferred to the callee. More...
 
virtual bool lookupLabel (Packet *ipdatagram, LabelOpVector &outLabel, std::string &outInterface, int &color) override
 The packet argument is an input parameter, the rest (outLabel, outInterface, color) are output parameters only. More...
 
virtual void receiveSignal (cComponent *source, simsignal_t signalID, cObject *obj, cObject *details) override
 
- Protected Member Functions inherited from inet::RoutingProtocolBase
virtual bool isInitializeStage (int stage) const override
 
virtual bool isModuleStartStage (int stage) const override
 
virtual bool isModuleStopStage (int stage) const override
 
- Protected Member Functions inherited from inet::OperationalMixin< cSimpleModule >
virtual int numInitStages () const override
 
virtual void refreshDisplay () const override
 
virtual void handleMessage (cMessage *msg) override
 
virtual void handleMessageWhenDown (cMessage *msg)
 
virtual bool handleOperationStage (LifecycleOperation *operation, IDoneCallback *doneCallback) override
 Perform one stage of a lifecycle operation. More...
 
virtual State getInitialOperationalState () const
 Returns initial operational state: OPERATING or NOT_OPERATING. More...
 
virtual void handleActiveOperationTimeout (cMessage *message)
 
virtual bool isUp () const
 utility functions More...
 
virtual bool isDown () const
 
virtual void setOperationalState (State newState)
 
virtual void scheduleOperationTimeout (simtime_t timeout)
 
virtual void setupActiveOperation (LifecycleOperation *operation, IDoneCallback *doneCallback, State)
 
virtual void delayActiveOperationFinish (simtime_t timeout)
 
virtual void startActiveOperationExtraTime (simtime_t delay=SIMTIME_ZERO)
 
virtual void startActiveOperationExtraTimeOrFinish (simtime_t extraTime)
 
virtual void finishActiveOperation ()
 

Protected Attributes

simtime_t holdTime
 
simtime_t helloInterval
 
FecVector fecList
 
FecBindVector fecUp
 
FecBindVector fecDown
 
PendingVector pending
 
PeerVector myPeers
 
ModuleRefByPar< IInterfaceTableift
 
ModuleRefByPar< IIpv4RoutingTablert
 
ModuleRefByPar< LibTablelt
 
ModuleRefByPar< Tedtedmod
 
UdpSocket udpSocket
 
std::vector< UdpSocketudpSockets
 
TcpSocket serverSocket
 
SocketMap socketMap
 
cMessage * sendHelloMsg = nullptr
 
int maxFecid = 0
 
- Protected Attributes inherited from inet::OperationalMixin< cSimpleModule >
State operationalState
 
simtime_t lastChange
 
Operation activeOperation
 
cMessage * activeOperationTimeout
 
cMessage * activeOperationExtraTimer
 

Additional Inherited Members

- Protected Types inherited from inet::OperationalMixin< cSimpleModule >
enum  State
 

Detailed Description

LDP (rfc 3036) protocol implementation.

Member Typedef Documentation

◆ FecBindVector

typedef std::vector<fec_bind_t> inet::Ldp::FecBindVector

◆ FecVector

typedef std::vector<fec_t> inet::Ldp::FecVector

◆ PeerVector

typedef std::vector<peer_info> inet::Ldp::PeerVector

◆ PendingVector

Constructor & Destructor Documentation

◆ Ldp()

inet::Ldp::Ldp ( )
78 {
79 }

◆ ~Ldp()

inet::Ldp::~Ldp ( )
virtual
82 {
83  for (auto& elem : myPeers)
84  cancelAndDelete(elem.timeout);
85 
86  cancelAndDelete(sendHelloMsg);
87  // this causes segfault at the end of simulation -- Vojta
88 // socketMap.deleteSockets();
89 }

Member Function Documentation

◆ announceLinkChange()

void inet::Ldp::announceLinkChange ( int  tedlinkindex)
protectedvirtual
1283 {
1284  TedChangeInfo d;
1285  d.setTedLinkIndicesArraySize(1);
1286  d.setTedLinkIndices(0, tedlinkindex);
1287  emit(tedChangedSignal, &d);
1288 }

Referenced by processHelloTimeout(), and processLDPHello().

◆ findFecEntry() [1/2]

Ldp::FecBindVector::iterator inet::Ldp::findFecEntry ( FecBindVector fecs,
int  fecid,
Ipv4Address  peer 
)
protected
857 {
858  auto it = fecs.begin();
859  for (; it != fecs.end(); it++) {
860  if ((it->fecid == fecid) && (it->peer == peer))
861  break;
862  }
863  return it;
864 }

◆ findFecEntry() [2/2]

Ldp::FecVector::iterator inet::Ldp::findFecEntry ( FecVector fecs,
Ipv4Address  addr,
int  length 
)
protected
867 {
868  auto it = fecs.begin();
869  for (; it != fecs.end(); it++) {
870  if ((it->length == length) && (it->addr == addr)) // TODO compare only relevant part (?)
871  break;
872  }
873  return it;
874 }

Referenced by lookupLabel(), processLABEL_MAPPING(), processLABEL_RELEASE(), processLABEL_REQUEST(), processLABEL_WITHDRAW(), processNOTIFICATION(), rebuildFecList(), and updateFecListEntry().

◆ findInterfaceFromPeerAddr()

std::string inet::Ldp::findInterfaceFromPeerAddr ( Ipv4Address  peerIP)
protected
829 {
830 /*
831  int i;
832  for (unsigned int i=0;i<myPeers.size();i++)
833  {
834  if (myPeers[i].peerIP == peerIP)
835  return string(myPeers[i].linkInterface);
836  }
837  return string("X");
838  */
839  // Rely on port index to find the interface name
840 
841  // this function is a misnomer, we must recognize our own address too
842  if (rt->isLocalAddress(peerIP))
843  return "lo0";
844 
845  NetworkInterface *ie = rt->getInterfaceForDestAddr(peerIP);
846  if (!ie)
847  throw cRuntimeError("findInterfaceFromPeerAddr(): %s is not routable", peerIP.str().c_str());
848  return ie->getInterfaceName();
849 }

Referenced by lookupLabel(), processLABEL_MAPPING(), processLABEL_REQUEST(), and updateFecListEntry().

◆ findPeer()

int inet::Ldp::findPeer ( Ipv4Address  peerAddr)
protectedvirtual

Utility: return peer's index in myPeers table, or -1 if not found.

1194 {
1195  for (auto i = myPeers.begin(); i != myPeers.end(); ++i)
1196  if (i->peerIP == peerAddr)
1197  return i - myPeers.begin();
1198 
1199  return -1;
1200 }

Referenced by findPeerSocket(), processLDPHello(), and socketAvailable().

◆ findPeerAddrFromInterface()

Ipv4Address inet::Ldp::findPeerAddrFromInterface ( std::string  interfaceName)
protectedvirtual

This method maps the peerIP with the interface name in routing table.

It is expected that for MPLS host, entries linked to MPLS peers are available. In case no corresponding peerIP found, a peerIP (not deterministic) will be returned.

793 {
794  int i = 0;
795  int k = 0;
796  NetworkInterface *ie = ift->findInterfaceByName(interfaceName.c_str());
797  if (ie == nullptr)
798  return Ipv4Address();
799 
800  const Ipv4Route *anEntry;
801 
802  for (i = 0; i < rt->getNumRoutes(); i++) {
803  for (k = 0; k < (int)myPeers.size(); k++) {
804  anEntry = rt->getRoute(i);
805  if (anEntry->getDestination() == myPeers[k].peerIP && anEntry->getInterface() == ie) {
806  return myPeers[k].peerIP;
807  }
808 // addresses->push_back(peerIP[k]);
809  }
810  }
811 
812  // Return any IP which has default route - not in routing table entries
813  for (i = 0; i < (int)myPeers.size(); i++) {
814  for (k = 0; k < rt->getNumRoutes(); k++) {
815  anEntry = rt->getRoute(i);
816  if (anEntry->getDestination() == myPeers[i].peerIP)
817  break;
818  }
819  if (k == rt->getNumRoutes())
820  break;
821  }
822 
823  // return the peer's address if found, unspecified address otherwise
824  return i == (int)myPeers.size() ? Ipv4Address() : myPeers[i].peerIP;
825 }

Referenced by locateNextHop().

◆ findPeerSocket()

TcpSocket * inet::Ldp::findPeerSocket ( Ipv4Address  peerAddr)
protectedvirtual

Utility: return socket for given peer, and nullptr if session doesn't exist.

1203 {
1204  // find peer in table and return its socket
1205  int i = findPeer(peerAddr);
1206  if (i == -1 || !(myPeers[i].socket) || myPeers[i].socket->getState() != TcpSocket::CONNECTED)
1207  return nullptr; // we don't have an LDP session to this peer
1208  return myPeers[i].socket;
1209 }

Referenced by getPeerSocket(), processLABEL_REQUEST(), and updateFecListEntry().

◆ getPeerSocket()

TcpSocket * inet::Ldp::getPeerSocket ( Ipv4Address  peerAddr)
protectedvirtual

Utility: return socket for given peer.

Throws error if there's no TCP connection

1212 {
1213  TcpSocket *sock = findPeerSocket(peerAddr);
1214  ASSERT(sock);
1215  if (!sock)
1216  throw cRuntimeError("No LDP session to peer %s yet", peerAddr.str().c_str());
1217  return sock;
1218 }

Referenced by sendToPeer().

◆ handleCrashOperation()

void inet::Ldp::handleCrashOperation ( LifecycleOperation operation)
overridevirtual

Implements inet::OperationalMixin< cSimpleModule >.

249 {
250  for (auto& elem : myPeers)
251  cancelAndDelete(elem.timeout);
252  myPeers.clear();
253  cancelEvent(sendHelloMsg);
254 
255  udpSocket.destroy();
256  for (auto& s : udpSockets)
257  s.destroy();
259  for (auto s : socketMap.getMap())
260  s.second->destroy();
261 }

◆ handleMessageWhenUp()

void inet::Ldp::handleMessageWhenUp ( cMessage *  msg)
overrideprotectedvirtual

Implements inet::OperationalMixin< cSimpleModule >.

148 {
149  EV_INFO << "Received: (" << msg->getClassName() << ")" << msg->getName() << "\n";
150  if (msg == sendHelloMsg) {
151  ASSERT(msg->isSelfMessage());
152  // every LDP capable router periodically sends HELLO messages to the
153  // "all routers in the sub-network" multicast address
154  EV_INFO << "Multicasting LDP Hello to neighboring routers\n";
156 
157  // schedule next hello
158  scheduleAfter(helloInterval, sendHelloMsg);
159  }
160  else if (msg->isSelfMessage()) {
161  EV_INFO << "Timer " << msg->getName() << " expired\n";
162  if (!strcmp(msg->getName(), "HelloTimeout")) {
163  processHelloTimeout(msg);
164  }
165  else {
166  auto ldpPacket = check_and_cast<Packet *>(msg)->popAtFront<LdpPacket>();
167  processNOTIFICATION(ldpPacket, /*rescheduled*/ true);
168  delete msg;
169  }
170  }
171  else {
172  ISocket *socket = socketMap.findSocketFor(msg);
173  if (socket) {
174  socket->processMessage(msg);
175  }
176  else if (serverSocket.belongsToSocket(msg)) {
178  }
179  else if (udpSocket.belongsToSocket(msg)) {
181  }
182  else {
183  auto& tags = check_and_cast<ITaggedObject *>(msg)->getTags();
184  int socketId = tags.getTag<SocketInd>()->getSocketId();
185  for (auto& s : udpSockets) {
186  if (s.getSocketId() == socketId) {
187  s.processMessage(msg);
188  return;
189  }
190  }
191  throw cRuntimeError("model error: no socket found for msg '%s' with socketId %d", msg->getName(), socketId);
192  }
193  }
194  // TODO move to separate function and reuse from socketClosed
195  if (operationalState == State::STOPPING_OPERATION) {
196  if (udpSocket.isOpen() || serverSocket.isOpen())
197  return;
198  // TODO check for empty sockets?
199  for (auto& s : udpSockets)
200  if (s.isOpen())
201  return;
202  for (auto s : socketMap.getMap())
203  if (s.second->isOpen())
204  return;
205  udpSockets.clear();
207  startActiveOperationExtraTimeOrFinish(par("stopOperationExtraTime"));
208  }
209 }

◆ handleStartOperation()

void inet::Ldp::handleStartOperation ( LifecycleOperation operation)
overridevirtual

Implements inet::OperationalMixin< cSimpleModule >.

229 {
230  scheduleAfter(exponential(0.1), sendHelloMsg);
231 }

◆ handleStopOperation()

void inet::Ldp::handleStopOperation ( LifecycleOperation operation)
overridevirtual

Implements inet::OperationalMixin< cSimpleModule >.

234 {
235  for (auto& elem : myPeers)
236  cancelAndDelete(elem.timeout);
237  myPeers.clear();
238  cancelEvent(sendHelloMsg);
239  udpSocket.close();
240  for (auto& s : udpSockets)
241  s.close();
243  for (auto s : socketMap.getMap())
244  s.second->close();
245  delayActiveOperationFinish(par("stopOperationTimeout"));
246 }

◆ initialize()

void inet::Ldp::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::OperationalMixin< cSimpleModule >.

92 {
94 
95  // FIXME move bind() and listen() calls to a new startModule() function, and call it from initialize() and from handleOperationStage()
96  // FIXME register to NetworkInterface changes, for detecting the interface add/delete, and detecting multicast config changes:
97  // should be refresh the udpSockets vector when interface added/deleted, or isMulticast() value changed.
98 
99  if (stage == INITSTAGE_LOCAL) {
100  holdTime = par("holdTime");
101  helloInterval = par("helloInterval");
102 
103  ift.reference(this, "interfaceTableModule", true);
104  rt.reference(this, "routingTableModule", true);
105  lt.reference(this, "libTableModule", true);
106  tedmod.reference(this, "tedModule", true);
107 
108  WATCH_VECTOR(myPeers);
109  WATCH_VECTOR(fecUp);
110  WATCH_VECTOR(fecDown);
111  WATCH_VECTOR(fecList);
112  WATCH_VECTOR(pending);
113 
114  maxFecid = 0;
115  sendHelloMsg = new cMessage("LDPSendHello");
116  }
117  else if (stage == INITSTAGE_ROUTING_PROTOCOLS) {
118  // bind UDP socket
119  udpSocket.setOutputGate(gate("socketOut"));
121  for (int i = 0; i < ift->getNumInterfaces(); ++i) {
122  NetworkInterface *ie = ift->getInterface(i);
123  if (ie->isMulticast()) {
124  udpSockets.push_back(UdpSocket());
125  udpSockets.back().setOutputGate(gate("socketOut"));
126  udpSockets.back().setMulticastLoop(false);
127  udpSockets.back().setMulticastOutputInterface(ie->getInterfaceId());
128  }
129  }
130 
131  // start listening for incoming TCP conns
132  EV_INFO << "Starting to listen on port " << LDP_PORT << " for incoming LDP sessions\n";
133  serverSocket.setOutputGate(gate("socketOut"));
136 
137  // build list of recognized FECs
138  rebuildFecList();
139 
140  // listen for routing table modifications
141  cModule *host = getContainingNode(this);
142  host->subscribe(routeAddedSignal, this);
143  host->subscribe(routeDeletedSignal, this);
144  }
145 }

◆ locateNextHop()

Ipv4Address inet::Ldp::locateNextHop ( Ipv4Address  dest)
protectedvirtual

This method finds next peer in upstream direction.

759 {
760  // Mapping L3 IP-host of next hop to L2 peer address.
761 
762  // Lookup the routing table, rfc3036
763  // "When the FEC for which a label is requested is a Prefix FEC Element or
764  // a Host Address FEC Element, the receiving LSR uses its routing table to determine
765  // its response. Unless its routing table includes an entry that exactly matches
766  // the requested Prefix or Host Address, the LSR must respond with a
767  // No Route Notification message."
768  //
769  // FIXME the code below (though seems like that's what the RFC refers to) doesn't work
770  // -- we can't reasonably expect the destination host to be exaplicitly in an
771  // LSR's routing table!!! Use simple IP routing instead. --Andras
772  //
773  // Wrong code:
774 // int i;
775 // for (i=0; i < rt->getNumRoutes(); i++)
776 // if (rt->getRoute(i)->host == dest)
777 // break;
778 //
779 // if (i == rt->getNumRoutes())
780 // return Ipv4Address(); // Signal an NOTIFICATION of NO ROUTE
781 //
782  NetworkInterface *ie = rt->getInterfaceForDestAddr(dest);
783  if (!ie)
784  return Ipv4Address(); // no route
785 
786  std::string iName = ie->getInterfaceName(); // FIXME why use name for lookup?
787  return findPeerAddrFromInterface(iName);
788 }

◆ lookupLabel()

bool inet::Ldp::lookupLabel ( Packet packet,
LabelOpVector outLabel,
std::string &  outInterface,
int &  color 
)
overrideprotectedvirtual

The packet argument is an input parameter, the rest (outLabel, outInterface, color) are output parameters only.

In subclasses, this function should be implemented to determine the forwarding equivalence class for the Ipv4 datagram passed, and map it to an outLabel and outInterface.

The color parameter (which can be set to an arbitrary value) will only be used for the NAM trace if one will be recorded.

Implements inet::IIngressClassifier.

1221 {
1222  const auto& ipv4Header = packet->peekAtFront<Ipv4Header>();
1223  Ipv4Address destAddr = ipv4Header->getDestAddress();
1224  int protocol = ipv4Header->getProtocolId();
1225 
1226  // never match and always route via L3 if:
1227 
1228  // OSPF traffic (Ted)
1229  if (protocol == IP_PROT_OSPF)
1230  return false;
1231 
1232  // LDP traffic (both discovery...
1233  if (protocol == IP_PROT_UDP) {
1234  const auto& udpHeader = packet->peekDataAt<UdpHeader>(ipv4Header->getChunkLength());
1235  if (udpHeader->getDestinationPort() == LDP_PORT)
1236  return false;
1237  }
1238  else if (protocol == IP_PROT_TCP) {
1239  // ...and session)
1240  const auto& tcpHeader = packet->peekDataAt<tcp::TcpHeader>(ipv4Header->getChunkLength());
1241  if (tcpHeader->getDestPort() == LDP_PORT || tcpHeader->getSrcPort() == LDP_PORT)
1242  return false;
1243  }
1244 
1245  // regular traffic, classify, label etc.
1246 
1247  for (auto& elem : fecList) {
1248  if (!destAddr.prefixMatches(elem.addr, elem.length))
1249  continue;
1250 
1251  EV_DETAIL << "FEC matched: " << elem << endl;
1252 
1253  auto dit = findFecEntry(fecDown, elem.fecid, elem.nextHop);
1254  if (dit != fecDown.end()) {
1255  outLabel = LibTable::pushLabel(dit->label);
1256  outInterface = findInterfaceFromPeerAddr(elem.nextHop);
1257  color = LDP_USER_TRAFFIC;
1258  EV_DETAIL << "mapping found, outLabel=" << outLabel << ", outInterface=" << outInterface << endl;
1259  return true;
1260  }
1261  else {
1262  EV_DETAIL << "no mapping for this FEC exists" << endl;
1263  return false;
1264  }
1265  }
1266  return false;
1267 }

◆ numInitStages()

virtual int inet::Ldp::numInitStages ( ) const
inlineoverrideprotectedvirtual
176 { return NUM_INIT_STAGES; }

◆ openTCPConnectionToPeer()

void inet::Ldp::openTCPConnectionToPeer ( int  peerIndex)
protectedvirtual
616 {
617  TcpSocket *socket = new TcpSocket();
618  socket->setOutputGate(gate("socketOut"));
619  socket->setCallback(this);
620  socket->setUserData((void *)((intptr_t)peerIndex));
621  socket->bind(rt->getRouterId(), 0);
622  socketMap.addSocket(socket);
623  myPeers[peerIndex].socket = socket;
624 
625  socket->connect(myPeers[peerIndex].peerIP, LDP_PORT);
626 }

Referenced by processLDPHello().

◆ processHelloTimeout()

void inet::Ldp::processHelloTimeout ( cMessage *  msg)
protectedvirtual
490 {
491  // peer is gone
492 
493  unsigned int i;
494  for (i = 0; i < myPeers.size(); i++)
495  if (myPeers[i].timeout == msg)
496  break;
497 
498  ASSERT(i < myPeers.size());
499 
500  Ipv4Address peerIP = myPeers[i].peerIP;
501 
502  EV_INFO << "peer=" << peerIP << " is gone, removing adjacency" << endl;
503 
504  ASSERT(!myPeers[i].timeout->isScheduled());
505  delete myPeers[i].timeout;
506  ASSERT(myPeers[i].socket);
507  myPeers[i].socket->abort(); // should we only close?
508  delete myPeers[i].socket;
509  myPeers.erase(myPeers.begin() + i);
510 
511  EV_INFO << "removing (stale) bindings from fecDown for peer=" << peerIP << endl;
512 
513  for (auto dit = fecDown.begin(); dit != fecDown.end();) {
514  if (dit->peer != peerIP) {
515  dit++;
516  continue;
517  }
518 
519  EV_DETAIL << "label=" << dit->label << endl;
520 
521  // send release message just in case (?)
522  // what happens if peer is not really down and
523  // hello messages just disappeared?
524  // does the protocol recover on its own (TODO check this)
525 
526  dit = fecDown.erase(dit);
527  }
528 
529  EV_INFO << "removing bindings from sent to peer=" << peerIP << " from fecUp" << endl;
530 
531  for (auto uit = fecUp.begin(); uit != fecUp.end();) {
532  if (uit->peer != peerIP) {
533  uit++;
534  continue;
535  }
536 
537  EV_DETAIL << "label=" << uit->label << endl;
538 
539  // send withdraw message just in case (?)
540  // see comment above...
541 
542  uit = fecUp.erase(uit);
543  }
544 
545  EV_INFO << "updating fecList" << endl;
546 
547  updateFecList(peerIP);
548 
549  // update TED and routing table
550 
551  unsigned int index = tedmod->linkIndex(rt->getRouterId(), peerIP);
552  tedmod->ted[index].state = false;
553  announceLinkChange(index);
554  tedmod->rebuildRoutingTable();
555 }

Referenced by handleMessageWhenUp().

◆ processLABEL_MAPPING()

void inet::Ldp::processLABEL_MAPPING ( Ptr< const LdpPacket > &  ldpPacket)
protectedvirtual
1137 {
1138  const auto& packet = CHK(dynamicPtrCast<const LdpLabelMapping>(ldpPacket));
1139  FecTlv fec = packet->getFec();
1140  int label = packet->getLabel();
1141  Ipv4Address fromIP = packet->getSenderAddress();
1142 
1143  EV_INFO << "Label mapping label=" << label << " received for fec=" << fec << " from " << fromIP << endl;
1144 
1145  ASSERT(label > 0);
1146 
1147  auto it = findFecEntry(fecList, fec.addr, fec.length);
1148  if (it == fecList.end())
1149  throw cRuntimeError("Model error: fec not in fecList");
1150 
1151  auto dit = findFecEntry(fecDown, it->fecid, fromIP);
1152  if (dit != fecDown.end())
1153  throw cRuntimeError("Model error: found in fecDown");
1154 
1155  // insert among received mappings
1156 
1157  fec_bind_t newItem;
1158  newItem.fecid = it->fecid;
1159  newItem.peer = fromIP;
1160  newItem.label = label;
1161  fecDown.push_back(newItem);
1162 
1163  // respond to pending requests
1164 
1165  for (auto pit = pending.begin(); pit != pending.end();) {
1166  if (pit->fecid != it->fecid) {
1167  pit++;
1168  continue;
1169  }
1170 
1171  EV_DETAIL << "there's pending request for this FEC from " << pit->peer << ", sending mapping" << endl;
1172 
1173  std::string inInterface = findInterfaceFromPeerAddr(pit->peer);
1174  std::string outInterface = findInterfaceFromPeerAddr(fromIP);
1175  LabelOpVector outLabel = LibTable::swapLabel(label);
1176 
1177  fec_bind_t newItem;
1178  newItem.fecid = it->fecid;
1179  newItem.peer = pit->peer;
1180  newItem.label = lt->installLibEntry(-1, inInterface, outLabel, outInterface, LDP_USER_TRAFFIC);
1181  fecUp.push_back(newItem);
1182 
1183  EV_DETAIL << "installed LIB entry inLabel=" << newItem.label << " inInterface=" << inInterface
1184  << " outLabel=" << outLabel << " outInterface=" << outInterface << endl;
1185 
1186  sendMapping(LABEL_MAPPING, pit->peer, newItem.label, it->addr, it->length);
1187 
1188  // remove request from the list
1189  pit = pending.erase(pit);
1190  }
1191 }

Referenced by processLdpPacketFromTcp().

◆ processLABEL_RELEASE()

void inet::Ldp::processLABEL_RELEASE ( Ptr< const LdpPacket > &  ldpPacket)
protectedvirtual
1059 {
1060  const auto& packet = CHK(dynamicPtrCast<const LdpLabelMapping>(ldpPacket));
1061  FecTlv fec = packet->getFec();
1062  int label = packet->getLabel();
1063  Ipv4Address fromIP = packet->getSenderAddress();
1064 
1065  EV_INFO << "Mapping release received for label=" << label << " fec=" << fec << " from " << fromIP << endl;
1066 
1067  ASSERT(label > 0);
1068 
1069  // remove label from fecUp
1070 
1071  auto it = findFecEntry(fecList, fec.addr, fec.length);
1072  if (it == fecList.end()) {
1073  EV_INFO << "FEC no longer recognized here, ignoring" << endl;
1074  return;
1075  }
1076 
1077  auto uit = findFecEntry(fecUp, it->fecid, fromIP);
1078  if (uit == fecUp.end() || label != uit->label) {
1079  // this is ok and may happen; e.g. we removed the mapping because downstream
1080  // neighbour withdrew its mapping. we sent withdraw upstream as well and
1081  // this is upstream's response
1082  EV_INFO << "mapping not found among sent mappings, ignoring" << endl;
1083  return;
1084  }
1085 
1086  EV_DETAIL << "removing from LIB table label=" << uit->label << endl;
1087  lt->removeLibEntry(uit->label);
1088 
1089  EV_DETAIL << "removing label from list of sent mappings" << endl;
1090  fecUp.erase(uit);
1091 }

Referenced by processLdpPacketFromTcp().

◆ processLABEL_REQUEST()

void inet::Ldp::processLABEL_REQUEST ( Ptr< const LdpPacket > &  ldpPacket)
protectedvirtual
972 {
973  const auto& packet = CHK(dynamicPtrCast<const LdpLabelRequest>(ldpPacket));
974  FecTlv fec = packet->getFec();
975  Ipv4Address srcAddr = packet->getSenderAddress();
976 
977  EV_INFO << "Label Request from LSR " << srcAddr << " for FEC " << fec << endl;
978 
979  auto it = findFecEntry(fecList, fec.addr, fec.length);
980  if (it == fecList.end()) {
981  EV_DETAIL << "FEC not recognized, sending back No route message" << endl;
982 
983  sendNotify(NO_ROUTE, srcAddr, fec.addr, fec.length);
984  return;
985  }
986 
987  // do we already have mapping for this fec from our downstream peer?
988 
989  //
990  // TODO this code duplicates rebuildFecList
991  //
992 
993  // does upstream have mapping from us?
994  auto uit = findFecEntry(fecUp, it->fecid, srcAddr);
995 
996  // shouldn't!
997  ASSERT(uit == fecUp.end());
998 
999  // do we have mapping from downstream?
1000  auto dit = findFecEntry(fecDown, it->fecid, it->nextHop);
1001 
1002  // is next hop our LDP peer?
1003  bool ER = !findPeerSocket(it->nextHop);
1004 
1005  ASSERT(!(ER && dit != fecDown.end())); // can't be egress and have mapping at the same time
1006 
1007  if (ER || dit != fecDown.end()) {
1008  fec_bind_t newItem;
1009  newItem.fecid = it->fecid;
1010  newItem.label = -1;
1011  newItem.peer = srcAddr;
1012  fecUp.push_back(newItem);
1013  uit = fecUp.end() - 1;
1014  }
1015 
1016  std::string inInterface = findInterfaceFromPeerAddr(srcAddr);
1017  std::string outInterface = findInterfaceFromPeerAddr(it->nextHop);
1018 
1019  if (ER) {
1020  // we are egress, that's easy:
1021  LabelOpVector outLabel = LibTable::popLabel();
1022 
1023  uit->label = lt->installLibEntry(uit->label, inInterface, outLabel, outInterface, 0);
1024 
1025  EV_DETAIL << "installed (egress) LIB entry inLabel=" << uit->label << " inInterface=" << inInterface
1026  << " outLabel=" << outLabel << " outInterface=" << outInterface << endl;
1027 
1028  // We are egress, let our upstream peer know
1029  // about it by sending back a Label Mapping message
1030 
1031  sendMapping(LABEL_MAPPING, srcAddr, uit->label, fec.addr, fec.length);
1032  }
1033  else if (dit != fecDown.end()) {
1034  // we have mapping from DS, that's easy
1035  LabelOpVector outLabel = LibTable::swapLabel(dit->label);
1036  uit->label = lt->installLibEntry(uit->label, inInterface, outLabel, outInterface, LDP_USER_TRAFFIC);
1037 
1038  EV_DETAIL << "installed LIB entry inLabel=" << uit->label << " inInterface=" << inInterface
1039  << " outLabel=" << outLabel << " outInterface=" << outInterface << endl;
1040 
1041  // We already have a mapping for this FEC, let our upstream peer know
1042  // about it by sending back a Label Mapping message
1043 
1044  sendMapping(LABEL_MAPPING, srcAddr, uit->label, fec.addr, fec.length);
1045  }
1046  else {
1047  // no mapping from DS, mark as pending
1048 
1049  EV_DETAIL << "no mapping for this FEC from the downstream router, marking as pending" << endl;
1050 
1051  pending_req_t newItem;
1052  newItem.fecid = it->fecid;
1053  newItem.peer = srcAddr;
1054  pending.push_back(newItem);
1055  }
1056 }

Referenced by processLdpPacketFromTcp().

◆ processLABEL_WITHDRAW()

void inet::Ldp::processLABEL_WITHDRAW ( Ptr< const LdpPacket > &  ldpPacket)
protectedvirtual
1094 {
1095  const auto& ldpLabelMapping = CHK(dynamicPtrCast<const LdpLabelMapping>(ldpPacket));
1096  FecTlv fec = ldpLabelMapping->getFec();
1097  int label = ldpLabelMapping->getLabel();
1098  Ipv4Address fromIP = ldpLabelMapping->getSenderAddress();
1099 
1100  EV_INFO << "Mapping withdraw received for label=" << label << " fec=" << fec << " from " << fromIP << endl;
1101 
1102  ASSERT(label > 0);
1103 
1104  // remove label from fecDown
1105 
1106  auto it = findFecEntry(fecList, fec.addr, fec.length);
1107  if (it == fecList.end()) {
1108  EV_INFO << "matching FEC not found, ignoring withdraw message" << endl;
1109  return;
1110  }
1111 
1112  auto dit = findFecEntry(fecDown, it->fecid, fromIP);
1113 
1114  if (dit == fecDown.end() || label != dit->label) {
1115  EV_INFO << "matching mapping not found, ignoring withdraw message" << endl;
1116  return;
1117  }
1118 
1119  ASSERT(dit != fecDown.end());
1120  ASSERT(label == dit->label);
1121 
1122  EV_INFO << "removing label from list of received mappings" << endl;
1123  fecDown.erase(dit);
1124 
1125  EV_INFO << "sending back relase message" << endl;
1126  auto reply = makeShared<LdpLabelMapping>(*ldpLabelMapping.get());
1127  reply->setType(LABEL_RELEASE);
1128  auto pk = new Packet("LDP_RELEASE", reply);
1129 // pk->addTag<PacketProtocolTag>()->setProtocol(&Protocol::ldp) //FIXME
1130  // send msg to peer over TCP
1131  sendToPeer(fromIP, pk);
1132 
1133  updateFecListEntry(*it);
1134 }

Referenced by processLdpPacketFromTcp().

◆ processLDPHello()

void inet::Ldp::processLDPHello ( Packet msg)
protectedvirtual
558 {
559  int socketId = msg->getTag<SocketInd>()->getSocketId();
560  ASSERT(socketId == udpSocket.getSocketId());
561 
562  const auto& ldpHello = msg->peekAtFront<LdpHello>();
563 // Ipv4Address peerAddr = controlInfo->getSrcAddr().toIPv4();
564  Ipv4Address peerAddr = ldpHello->getSenderAddress();
565  int interfaceId = msg->getTag<InterfaceInd>()->getInterfaceId();
566  delete msg;
567 
568  EV_INFO << "Received LDP Hello from " << peerAddr << ", ";
569 
570  if (peerAddr.isUnspecified() || peerAddr == rt->getRouterId()) {
571  // must be ourselves (we're also in the all-routers multicast group), ignore
572  EV_INFO << "that's myself, ignore\n";
573  return;
574  }
575 
576  // mark link as working if it was failed, and rebuild table
577  unsigned int index = tedmod->linkIndex(rt->getRouterId(), peerAddr);
578  if (!tedmod->ted[index].state) {
579  tedmod->ted[index].state = true;
580  tedmod->rebuildRoutingTable();
581  announceLinkChange(index);
582  }
583 
584  // peer already in table?
585  int i = findPeer(peerAddr);
586  if (i != -1) {
587  EV_DETAIL << "already in my peer table, rescheduling timeout" << endl;
588  ASSERT(myPeers[i].timeout);
589  rescheduleAfter(holdTime, myPeers[i].timeout);
590  return;
591  }
592 
593  // not in table, add it
594  peer_info info;
595  info.peerIP = peerAddr;
596  info.linkInterface = ift->getInterfaceById(interfaceId)->getInterfaceName();
597  info.activeRole = peerAddr.getInt() > rt->getRouterId().getInt();
598  info.socket = nullptr;
599  info.timeout = new cMessage("HelloTimeout");
600  scheduleAfter(holdTime, info.timeout);
601  myPeers.push_back(info);
602  int peerIndex = myPeers.size() - 1;
603 
604  EV_INFO << "added to peer table\n";
605  EV_INFO << "We'll be " << (info.activeRole ? "ACTIVE" : "PASSIVE") << " in this session\n";
606 
607  // introduce ourselves with a Hello, then connect if we're in ACTIVE role
608  sendHelloTo(peerAddr);
609  if (info.activeRole) {
610  EV_INFO << "Establishing session with it\n";
611  openTCPConnectionToPeer(peerIndex);
612  }
613 }

Referenced by socketDataArrived().

◆ processLdpPacketFromTcp()

void inet::Ldp::processLdpPacketFromTcp ( Ptr< const LdpPacket > &  ldpPacket)
protectedvirtual
716 {
717  switch (ldpPacket->getType()) {
718  case HELLO:
719  throw cRuntimeError("Received LDP HELLO over TCP (should arrive over UDP)");
720  break;
721 
722  case ADDRESS:
723 // processADDRESS(ldpPacket);
724  throw cRuntimeError("Received LDP ADDRESS message, unsupported in this version");
725  break;
726 
727  case ADDRESS_WITHDRAW:
728 // processADDRESS_WITHDRAW(ldpPacket);
729  throw cRuntimeError("LDP PROC DEBUG: Received LDP ADDRESS_WITHDRAW message, unsupported in this version");
730  break;
731 
732  case LABEL_MAPPING:
733  processLABEL_MAPPING(ldpPacket);
734  break;
735 
736  case LABEL_REQUEST:
737  processLABEL_REQUEST(ldpPacket);
738  break;
739 
740  case LABEL_WITHDRAW:
741  processLABEL_WITHDRAW(ldpPacket);
742  break;
743 
744  case LABEL_RELEASE:
745  processLABEL_RELEASE(ldpPacket);
746  break;
747 
748  case NOTIFICATION:
749  processNOTIFICATION(ldpPacket, /*rescheduled*/ false);
750  break;
751 
752  default:
753  throw cRuntimeError("LDP PROC DEBUG: Unrecognized LDP Message Type, type is %d", ldpPacket->getType());
754  break;
755  }
756 }

Referenced by socketDataArrived().

◆ processNOTIFICATION()

void inet::Ldp::processNOTIFICATION ( Ptr< const LdpPacket > &  ldpPacket,
bool  rescheduled 
)
protectedvirtual
919 {
920  const auto& packet = CHK(dynamicPtrCast<const LdpNotify>(ldpPacket));
921  FecTlv fec = packet->getFec();
922  Ipv4Address srcAddr = packet->getSenderAddress();
923  int status = packet->getStatus();
924 
925  // FIXME NO_ROUTE processing should probably be split into two functions,
926  // this is not the cleanest thing I ever wrote :) --Vojta
927 
928  if (rescheduled) {
929  // re-scheduled by ourselves
930  EV_INFO << "notification retry for peer=" << srcAddr << " fec=" << fec << " status=" << status << endl;
931  }
932  else {
933  // received via network
934  EV_INFO << "notification received from=" << srcAddr << " fec=" << fec << " status=" << status << endl;
935  }
936 
937  switch (status) {
938  case NO_ROUTE: {
939  EV_INFO << "route does not exit on that peer" << endl;
940 
941  auto it = findFecEntry(fecList, fec.addr, fec.length);
942  if (it != fecList.end()) {
943  if (it->nextHop == srcAddr) {
944  if (!rescheduled) {
945  EV_DETAIL << "we are still interesed in this mapping, we will retry later" << endl;
946  auto pk = new Packet(0, ldpPacket);
947  scheduleAfter(1.0 /* FIXME */, pk);
948  return;
949  }
950  else {
951  EV_DETAIL << "reissuing request" << endl;
952 
953  sendMappingRequest(srcAddr, fec.addr, fec.length);
954  }
955  }
956  else
957  EV_DETAIL << "and we still recognize this FEC, but we use different next hop, forget it" << endl;
958  }
959  else
960  EV_DETAIL << "and we do not recognize this any longer, forget it" << endl;
961 
962  break;
963  }
964 
965  default:
966  ASSERT(false);
967  break;
968  }
969 }

Referenced by handleMessageWhenUp(), and processLdpPacketFromTcp().

◆ rebuildFecList()

void inet::Ldp::rebuildFecList ( )
protectedvirtual
342 {
343  EV_INFO << "make list of recognized FECs" << endl;
344 
345  FecVector oldList = fecList;
346  fecList.clear();
347 
348  for (int i = 0; i < rt->getNumRoutes(); i++) {
349  // every entry in the routing table
350 
351  const Ipv4Route *re = rt->getRoute(i);
352 
353  // ignore multicast routes
354  if (re->getDestination().isMulticast())
355  continue;
356 
357  // find out current next hop according to routing table
358  Ipv4Address nextHop = (re->getGateway().isUnspecified()) ? re->getDestination() : re->getGateway();
359  ASSERT(!nextHop.isUnspecified());
360 
361  EV_INFO << "nextHop <-- " << nextHop << endl;
362 
363  auto it = findFecEntry(oldList, re->getDestination(), re->getNetmask().getNetmaskLength());
364 
365  if (it == oldList.end()) {
366  // fec didn't exist, it was just created
367  fec_t newItem;
368  newItem.fecid = ++maxFecid;
369  newItem.addr = re->getDestination();
370  newItem.length = re->getNetmask().getNetmaskLength();
371  newItem.nextHop = nextHop;
372  updateFecListEntry(newItem);
373  fecList.push_back(newItem);
374  }
375  else if (it->nextHop != nextHop) {
376  // next hop for this FEC changed,
377  it->nextHop = nextHop;
378  updateFecListEntry(*it);
379  fecList.push_back(*it);
380  oldList.erase(it);
381  }
382  else {
383  // FEC didn't change, reusing old values
384  fecList.push_back(*it);
385  oldList.erase(it);
386  continue;
387  }
388  }
389 
390  // our own addresses (TODO is it needed?)
391 
392  for (int i = 0; i < ift->getNumInterfaces(); ++i) {
393  NetworkInterface *ie = ift->getInterface(i);
394 
395  // TODO should replace to ie->isUp() or drop this code:
396 // if (ie->getNetworkLayerGateIndex() < 0)
397 // continue;
398 
399  auto ipv4Data = ie->findProtocolData<Ipv4InterfaceData>();
400  if (!ipv4Data)
401  continue;
402 
403  auto it = findFecEntry(oldList, ipv4Data->getIPAddress(), 32);
404  if (it == oldList.end()) {
405  fec_t newItem;
406  newItem.fecid = ++maxFecid;
407  newItem.addr = ipv4Data->getIPAddress();
408  newItem.length = 32;
409  newItem.nextHop = ipv4Data->getIPAddress();
410  fecList.push_back(newItem);
411  }
412  else {
413  fecList.push_back(*it);
414  oldList.erase(it);
415  }
416  }
417 
418  if (oldList.size() > 0) {
419  EV_INFO << "there are " << oldList.size() << " deprecated FECs, removing them" << endl;
420 
421  for (auto& elem : oldList) {
422  EV_DETAIL << "removing FEC= " << elem << endl;
423 
424  for (auto& _dit : fecDown) {
425  if (_dit.fecid != elem.fecid)
426  continue;
427 
428  EV_DETAIL << "sending release label=" << _dit.label << " downstream to " << _dit.peer << endl;
429 
430  sendMapping(LABEL_RELEASE, _dit.peer, _dit.label, elem.addr, elem.length);
431  }
432 
433  for (auto& _uit : fecUp) {
434  if (_uit.fecid != elem.fecid)
435  continue;
436 
437  EV_DETAIL << "sending withdraw label=" << _uit.label << " upstream to " << _uit.peer << endl;
438 
439  sendMapping(LABEL_WITHDRAW, _uit.peer, _uit.label, elem.addr, elem.length);
440 
441  EV_DETAIL << "removing entry inLabel=" << _uit.label << " from LIB" << endl;
442 
443  lt->removeLibEntry(_uit.label);
444  }
445  }
446  }
447 
448  // we must keep this list sorted for matching to work correctly
449  // this is probably slower than it must be
450  std::stable_sort(fecList.begin(), fecList.end(), fecPrefixCompare);
451 }

Referenced by initialize(), and receiveSignal().

◆ receiveSignal()

void inet::Ldp::receiveSignal ( cComponent *  source,
simsignal_t  signalID,
cObject *  obj,
cObject *  details 
)
overrideprotectedvirtual
1270 {
1271  Enter_Method("%s", cComponent::getSignalName(signalID));
1272 
1273  printSignalBanner(signalID, obj, details);
1274 
1275  ASSERT(signalID == routeAddedSignal || signalID == routeDeletedSignal);
1276 
1277  EV_INFO << "routing table changed, rebuild list of known FEC" << endl;
1278 
1279  rebuildFecList();
1280 }

◆ sendHelloTo()

void inet::Ldp::sendHelloTo ( Ipv4Address  dest)
protectedvirtual
464 {
465  Packet *pk = new Packet("LDP-Hello");
466  const auto& hello = makeShared<LdpHello>();
467  hello->setChunkLength(LDP_HEADER_BYTES);
468  hello->setType(HELLO);
469  hello->setSenderAddress(rt->getRouterId());
470 // hello->setReceiverAddress(...);
471  hello->setHoldTime(SIMTIME_DBL(holdTime));
472 // hello->setRbit(...);
473 // hello->setTbit(...);
474  pk->insertAtBack(hello);
475  pk->addPar("color") = LDP_HELLO_TRAFFIC;
476 
477  if (dest.isMulticast()) {
478  for (size_t i = 0; i < udpSockets.size(); ++i) {
479  Packet *msg = (i == udpSockets.size() - 1) ? pk : pk->dup();
480  udpSockets[i].sendTo(msg, dest, LDP_PORT);
481  }
482  if (udpSockets.size() == 0)
483  delete pk;
484  }
485  else
486  udpSocket.sendTo(pk, dest, LDP_PORT);
487 }

Referenced by handleMessageWhenUp(), and processLDPHello().

◆ sendMapping()

void inet::Ldp::sendMapping ( int  type,
Ipv4Address  dest,
int  label,
Ipv4Address  addr,
int  length 
)
protectedvirtual
898 {
899  // Send LABEL MAPPING downstream
900  Packet *packet = new Packet("Lb-Mapping");
901  const auto& lmMessage = makeShared<LdpLabelMapping>();
902  lmMessage->setChunkLength(LDP_HEADER_BYTES); // FIXME find out actual length
903  lmMessage->setType(type);
904  lmMessage->setReceiverAddress(dest);
905  lmMessage->setSenderAddress(rt->getRouterId());
906  lmMessage->setLabel(label);
907 
908  FecTlv fec;
909  fec.addr = addr;
910  fec.length = length;
911 
912  lmMessage->setFec(fec);
913  packet->insertAtBack(lmMessage);
914 
915  sendToPeer(dest, packet);
916 }

Referenced by processLABEL_MAPPING(), processLABEL_REQUEST(), rebuildFecList(), and updateFecListEntry().

◆ sendMappingRequest()

void inet::Ldp::sendMappingRequest ( Ipv4Address  dest,
Ipv4Address  addr,
int  length 
)
protectedvirtual
269 {
270  Packet *pk = new Packet("Lb-Req");
271  const auto& requestMsg = makeShared<LdpLabelRequest>();
272  requestMsg->setChunkLength(LDP_HEADER_BYTES); // FIXME find out actual length
273  requestMsg->setType(LABEL_REQUEST);
274 
275  FecTlv fec;
276  fec.addr = addr;
277  fec.length = length;
278  requestMsg->setFec(fec);
279 
280  requestMsg->setReceiverAddress(dest);
281  requestMsg->setSenderAddress(rt->getRouterId());
282  pk->insertAtBack(requestMsg);
283 
284  sendToPeer(dest, pk);
285 }

Referenced by processNOTIFICATION(), and updateFecListEntry().

◆ sendNotify()

void inet::Ldp::sendNotify ( int  status,
Ipv4Address  dest,
Ipv4Address  addr,
int  length 
)
protectedvirtual
877 {
878  // Send NOTIFY message
879  Packet *packet = new Packet("Lb-Notify");
880  const auto& lnMessage = makeShared<LdpNotify>();
881  lnMessage->setChunkLength(LDP_HEADER_BYTES); // FIXME find out actual length
882  lnMessage->setType(NOTIFICATION);
883  lnMessage->setStatus(NO_ROUTE);
884  lnMessage->setReceiverAddress(dest);
885  lnMessage->setSenderAddress(rt->getRouterId());
886 
887  FecTlv fec;
888  fec.addr = addr;
889  fec.length = length;
890 
891  lnMessage->setFec(fec);
892  packet->insertAtBack(lnMessage);
893 
894  sendToPeer(dest, packet);
895 }

Referenced by processLABEL_REQUEST().

◆ sendToPeer()

void inet::Ldp::sendToPeer ( Ipv4Address  dest,
Packet msg 
)
protectedvirtual
264 {
265  getPeerSocket(dest)->send(msg);
266 }

Referenced by processLABEL_WITHDRAW(), sendMapping(), sendMappingRequest(), and sendNotify().

◆ socketAvailable()

void inet::Ldp::socketAvailable ( TcpSocket socket,
TcpAvailableInfo availableInfo 
)
overrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

640 {
641  // TODO
642  // not yet in socketMap, must be new incoming connection.
643  // find which peer it is and register connection
644  TcpSocket *newSocket = new TcpSocket(availableInfo);
645  newSocket->setOutputGate(gate("socketOut"));
646 
647  // FIXME there seems to be some confusion here. Is it sure that
648  // routerIds we use as peerAddrs are the same as IP addresses
649  // the routing is based on? --Andras
650  Ipv4Address peerAddr = newSocket->getRemoteAddress().toIpv4();
651 
652  int i = findPeer(peerAddr);
653  if (i == -1 || myPeers[i].socket) {
654  // nothing known about this guy, or already connected: refuse
655  newSocket->close(); // reset()?
656  delete newSocket;
657  return;
658  }
659  myPeers[i].socket = newSocket;
660  newSocket->setCallback(this);
661  newSocket->setUserData((void *)((intptr_t)i));
662  socketMap.addSocket(newSocket);
663  socketocket->accept(availableInfo->getNewSocketId());
664 }

◆ socketClosed() [1/2]

void inet::Ldp::socketClosed ( TcpSocket socket)
overrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

696 {
697  peer_info& peer = myPeers[(uintptr_t)socket->getUserData()];
698  EV_INFO << "TCP connection to peer " << peer.peerIP << " closed\n";
699 
700  ASSERT(false);
701 
702  // FIXME what now? reconnect after a delay?
703 }

◆ socketClosed() [2/2]

void inet::Ldp::socketClosed ( UdpSocket socket)
overrideprotectedvirtual

Notifies about socket closed, indication ownership is transferred to the callee.

Implements inet::UdpSocket::ICallback.

225 {
226 }

◆ socketDataArrived() [1/2]

void inet::Ldp::socketDataArrived ( TcpSocket socket)
overrideprotectedvirtual

Implements inet::TcpSocket::ReceiveQueueBasedCallback.

667 {
668  peer_info& peer = myPeers[(uintptr_t)socket->getUserData()];
669  EV_INFO << "Message arrived over TCP from peer " << peer.peerIP << "\n";
670 
671  auto queue = socket->getReceiveQueue();
672  while (queue->has<LdpPacket>()) {
673  auto header = queue->pop<LdpPacket>();
674  processLdpPacketFromTcp(header);
675  }
676 }

◆ socketDataArrived() [2/2]

void inet::Ldp::socketDataArrived ( UdpSocket socket,
Packet packet 
)
overrideprotectedvirtual

Notifies about data arrival, packet ownership is transferred to the callee.

Implements inet::UdpSocket::ICallback.

212 {
213  // process incoming udp packet
214  // FIXME add implementation
215  processLDPHello(check_and_cast<Packet *>(packet));
216 }

◆ socketDeleted()

virtual void inet::Ldp::socketDeleted ( TcpSocket socket)
inlineoverrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

202 {} // TODO

◆ socketErrorArrived()

void inet::Ldp::socketErrorArrived ( UdpSocket socket,
Indication indication 
)
overrideprotectedvirtual

Notifies about error indication arrival, indication ownership is transferred to the callee.

Implements inet::UdpSocket::ICallback.

219 {
220  EV_WARN << "Ignoring UDP error report " << indication->getName() << endl;
221  delete indication;
222 }

◆ socketEstablished()

void inet::Ldp::socketEstablished ( TcpSocket socket)
overrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

629 {
630  peer_info& peer = myPeers[(uintptr_t)socket->getUserData()];
631  EV_INFO << "TCP connection established with peer " << peer.peerIP << "\n";
632 
633  // we must update all entries with nextHop == peerIP
634  updateFecList(peer.peerIP);
635 
636  // FIXME start LDP session setup (if we're on the active side?)
637 }

◆ socketFailure()

void inet::Ldp::socketFailure ( TcpSocket socket,
int  code 
)
overrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

706 {
707  peer_info& peer = myPeers[(uintptr_t)socket->getUserData()];
708  EV_INFO << "TCP connection to peer " << peer.peerIP << " broken\n";
709 
710  ASSERT(false);
711 
712  // FIXME what now? reconnect after a delay?
713 }

◆ socketPeerClosed()

void inet::Ldp::socketPeerClosed ( TcpSocket socket)
overrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

679 {
680  peer_info& peer = myPeers[(uintptr_t)socket->getUserData()];
681  EV_INFO << "Peer " << peer.peerIP << " closed TCP connection\n";
682 
683  ASSERT(false);
684 
685 /*
686  // close the connection (if not already closed)
687  if (socket.getState()==TcpSocket::PEER_CLOSED)
688  {
689  EV << "remote TCP closed, closing here as well\n";
690  close();
691  }
692  */
693 }

◆ socketStatusArrived()

virtual void inet::Ldp::socketStatusArrived ( TcpSocket socket,
TcpStatusInfo status 
)
inlineoverrideprotectedvirtual

Implements inet::TcpSocket::ICallback.

201 {}

◆ updateFecList()

void inet::Ldp::updateFecList ( Ipv4Address  nextHop)
protectedvirtual
454 {
455  for (auto& elem : fecList) {
456  if (elem.nextHop != nextHop)
457  continue;
458 
459  updateFecListEntry(elem);
460  }
461 }

Referenced by processHelloTimeout(), and socketEstablished().

◆ updateFecListEntry()

void inet::Ldp::updateFecListEntry ( Ldp::fec_t  oldItem)
protectedvirtual
288 {
289  // do we have mapping from downstream?
290  auto dit = findFecEntry(fecDown, oldItem.fecid, oldItem.nextHop);
291 
292  // is next hop our LDP peer?
293  bool ER = findPeerSocket(oldItem.nextHop) == nullptr;
294 
295  ASSERT(!(ER && dit != fecDown.end())); // can't be egress and have mapping at the same time
296 
297  // adjust upstream mappings
298  for (auto uit = fecUp.begin(); uit != fecUp.end();) {
299  if (uit->fecid != oldItem.fecid) {
300  uit++;
301  continue;
302  }
303 
304  std::string inInterface = findInterfaceFromPeerAddr(uit->peer);
305  std::string outInterface = findInterfaceFromPeerAddr(oldItem.nextHop);
306  if (ER) {
307  // we are egress, that's easy:
308  LabelOpVector outLabel = LibTable::popLabel();
309  uit->label = lt->installLibEntry(uit->label, inInterface, outLabel, outInterface, LDP_USER_TRAFFIC);
310 
311  EV_DETAIL << "installed (egress) LIB entry inLabel=" << uit->label << " inInterface=" << inInterface
312  << " outLabel=" << outLabel << " outInterface=" << outInterface << endl;
313  uit++;
314  }
315  else if (dit != fecDown.end()) {
316  // we have mapping from DS, that's easy
317  LabelOpVector outLabel = LibTable::swapLabel(dit->label);
318  uit->label = lt->installLibEntry(uit->label, inInterface, outLabel, outInterface, LDP_USER_TRAFFIC);
319 
320  EV_DETAIL << "installed LIB entry inLabel=" << uit->label << " inInterface=" << inInterface
321  << " outLabel=" << outLabel << " outInterface=" << outInterface << endl;
322  uit++;
323  }
324  else {
325  // no mapping from DS, withdraw mapping US
326  EV_INFO << "sending withdraw message upstream" << endl;
327  sendMapping(LABEL_WITHDRAW, uit->peer, uit->label, oldItem.addr, oldItem.length);
328 
329  // remove from US mappings
330  uit = fecUp.erase(uit);
331  }
332  }
333 
334  if (!ER && dit == fecDown.end()) {
335  // and ask DS for mapping
336  EV_INFO << "sending request message downstream" << endl;
337  sendMappingRequest(oldItem.nextHop, oldItem.addr, oldItem.length);
338  }
339 }

Referenced by processLABEL_WITHDRAW(), rebuildFecList(), and updateFecList().

Member Data Documentation

◆ fecDown

◆ fecList

◆ fecUp

◆ helloInterval

simtime_t inet::Ldp::helloInterval
protected

Referenced by handleMessageWhenUp(), and initialize().

◆ holdTime

simtime_t inet::Ldp::holdTime
protected

◆ ift

◆ lt

◆ maxFecid

int inet::Ldp::maxFecid = 0
protected

Referenced by initialize(), and rebuildFecList().

◆ myPeers

◆ pending

PendingVector inet::Ldp::pending
protected

◆ rt

◆ sendHelloMsg

cMessage* inet::Ldp::sendHelloMsg = nullptr
protected

◆ serverSocket

TcpSocket inet::Ldp::serverSocket
protected

◆ socketMap

◆ tedmod

ModuleRefByPar<Ted> inet::Ldp::tedmod
protected

◆ udpSocket

◆ udpSockets

std::vector<UdpSocket> inet::Ldp::udpSockets
protected

The documentation for this class was generated from the following files:
inet::UdpSocket::setOutputGate
void setOutputGate(cGate *toUdp)
Sets the gate on which to send to UDP.
Definition: UdpSocket.h:117
CHK
#define CHK(x)
Definition: INETDefs.h:87
inet::TcpSocket::send
virtual void send(Packet *msg) override
Sends data packet.
Definition: TcpSocket.cc:147
inet::NO_ROUTE
@ NO_ROUTE
Definition: LdpPacket_m.h:102
inet::LABEL_WITHDRAW
@ LABEL_WITHDRAW
Definition: LdpPacket_m.h:84
inet::ISocket::processMessage
virtual void processMessage(cMessage *msg)=0
Examines the message, takes ownership, and updates socket state.
inet::OperationalMixin< cSimpleModule >::operationalState
State operationalState
Definition: OperationalMixin.h:23
inet::Ldp::lt
ModuleRefByPar< LibTable > lt
Definition: Ldp.h:110
inet::UdpSocket::bind
void bind(int localPort)
Bind the socket to a local port number.
Definition: UdpSocket.cc:34
protocol
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down protocol
Definition: IUdp-gates.txt:25
inet::UdpSocket::sendTo
void sendTo(Packet *msg, L3Address destAddr, int destPort)
Sends a data packet to the given address and port.
Definition: UdpSocket.cc:69
inet::Ldp::processLDPHello
virtual void processLDPHello(Packet *msg)
Definition: Ldp.cc:557
inet::Ldp::sendHelloTo
virtual void sendHelloTo(Ipv4Address dest)
Definition: Ldp.cc:463
inet::LDP_HEADER_BYTES
const B LDP_HEADER_BYTES
Definition: Ldp.h:36
inet::Ldp::pending
PendingVector pending
Definition: Ldp.h:100
inet::IP_PROT_OSPF
@ IP_PROT_OSPF
Definition: IpProtocolId_m.h:104
inet::Ldp::getPeerSocket
virtual TcpSocket * getPeerSocket(Ipv4Address peerAddr)
Utility: return socket for given peer.
Definition: Ldp.cc:1211
inet::getContainingNode
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:40
inet::OperationalMixin< cSimpleModule >::initialize
virtual void initialize(int stage) override
Definition: OperationalMixinImpl.h:26
inet::TcpSocket::isOpen
virtual bool isOpen() const override
Definition: TcpSocket.cc:257
inet::NOTIFICATION
@ NOTIFICATION
Definition: LdpPacket_m.h:76
inet::UdpSocket::destroy
virtual void destroy() override
Notify the protocol that the owner of ISocket has destroyed the socket.
Definition: UdpSocket.cc:98
inet::printSignalBanner
void printSignalBanner(simsignal_t signalID, const cObject *obj, const cObject *details)
Utility function.
Definition: Simsignals.cc:126
inet::Ldp::sendToPeer
virtual void sendToPeer(Ipv4Address dest, Packet *msg)
Definition: Ldp.cc:263
inet::Ldp::serverSocket
TcpSocket serverSocket
Definition: Ldp.h:115
inet::Ldp::processHelloTimeout
virtual void processHelloTimeout(cMessage *msg)
Definition: Ldp.cc:489
inet::Ldp::socketMap
SocketMap socketMap
Definition: Ldp.h:116
inet::SocketMap::deleteSockets
void deleteSockets()
Deletes the socket objects.
Definition: SocketMap.cc:44
inet::Ldp::processLABEL_REQUEST
virtual void processLABEL_REQUEST(Ptr< const LdpPacket > &ldpPacket)
Definition: Ldp.cc:971
inet::Ldp::ift
ModuleRefByPar< IInterfaceTable > ift
Definition: Ldp.h:108
inet::TcpSocket::belongsToSocket
virtual bool belongsToSocket(cMessage *msg) const override
Returns true if the message belongs to this socket instance (message has a TcpCommand as getControlIn...
Definition: TcpSocket.cc:365
inet::Ldp::rt
ModuleRefByPar< IIpv4RoutingTable > rt
Definition: Ldp.h:109
inet::Ldp::processLABEL_RELEASE
virtual void processLABEL_RELEASE(Ptr< const LdpPacket > &ldpPacket)
Definition: Ldp.cc:1058
inet::SocketMap::findSocketFor
ISocket * findSocketFor(cMessage *msg)
Finds the socket for the given message.
Definition: SocketMap.cc:19
inet::Ldp::FecVector
std::vector< fec_t > FecVector
Definition: Ldp.h:63
inet::Ldp::updateFecListEntry
virtual void updateFecListEntry(fec_t oldItem)
Definition: Ldp.cc:287
inet::LABEL_RELEASE
@ LABEL_RELEASE
Definition: LdpPacket_m.h:85
inet::IP_PROT_UDP
@ IP_PROT_UDP
Definition: IpProtocolId_m.h:97
inet::Ldp::findFecEntry
FecVector::iterator findFecEntry(FecVector &fecs, Ipv4Address addr, int length)
Definition: Ldp.cc:866
inet::SocketMap::addSocket
void addSocket(ISocket *socket)
Adds the given socket.
Definition: SocketMap.cc:28
inet::units::values::s
value< double, units::s > s
Definition: Units.h:1235
inet::ADDRESS_WITHDRAW
@ ADDRESS_WITHDRAW
Definition: LdpPacket_m.h:81
inet::tedChangedSignal
simsignal_t tedChangedSignal
Definition: Simsignals.cc:38
inet::Ipv4Address::ALL_ROUTERS_MCAST
static const Ipv4Address ALL_ROUTERS_MCAST
224.0.0.2 All routers on a subnet
Definition: Ipv4Address.h:97
inet::Ldp::sendNotify
virtual void sendNotify(int status, Ipv4Address dest, Ipv4Address addr, int length)
Definition: Ldp.cc:876
inet::UdpSocket::processMessage
virtual void processMessage(cMessage *msg) override
Examines the message, takes ownership, and updates socket state.
Definition: UdpSocket.cc:343
LDP_USER_TRAFFIC
#define LDP_USER_TRAFFIC
Definition: Ldp.h:29
inet::Ldp::fecDown
FecBindVector fecDown
Definition: Ldp.h:98
inet::SocketMap::getMap
std::map< int, ISocket * > & getMap()
Returns the socket map.
Definition: SocketMap.h:57
inet::LabelOpVector
std::vector< LabelOp > LabelOpVector
Definition: LibTable.h:32
inet::LibTable::pushLabel
static LabelOpVector pushLabel(int label)
Definition: LibTable.cc:157
inet::Ldp::processLABEL_MAPPING
virtual void processLABEL_MAPPING(Ptr< const LdpPacket > &ldpPacket)
Definition: Ldp.cc:1136
inet::LibTable::swapLabel
static LabelOpVector swapLabel(int label)
Definition: LibTable.cc:167
type
removed type
Definition: IUdp-gates.txt:7
inet::TcpSocket::listen
void listen(bool fork)
Definition: TcpSocket.cc:95
inet::Ldp::fecList
FecVector fecList
Definition: Ldp.h:94
inet::TcpSocket::processMessage
void processMessage(cMessage *msg) override
Examines the message (which should have arrived from TCP), updates socket state, and if there is a ca...
Definition: TcpSocket.cc:281
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::Ldp::rebuildFecList
virtual void rebuildFecList()
Definition: Ldp.cc:341
inet::Ldp::announceLinkChange
virtual void announceLinkChange(int tedlinkindex)
Definition: Ldp.cc:1282
inet::UdpSocket::close
virtual void close() override
Unbinds the socket.
Definition: UdpSocket.cc:87
inet::routeAddedSignal
simsignal_t routeAddedSignal
Definition: Simsignals.cc:41
NUM_INIT_STAGES
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
inet::UdpSocket::belongsToSocket
virtual bool belongsToSocket(cMessage *msg) const override
Returns true if the message belongs to this socket instance (message has a UdpControlInfo as getContr...
Definition: UdpSocket.cc:373
inet::TcpSocket::destroy
virtual void destroy() override
Destroy the connection.
Definition: TcpSocket.cc:186
inet::Ldp::processLABEL_WITHDRAW
virtual void processLABEL_WITHDRAW(Ptr< const LdpPacket > &ldpPacket)
Definition: Ldp.cc:1093
inet::physicallayer::k
const double k
Definition: Qam1024Modulation.cc:14
inet::Ldp::myPeers
PeerVector myPeers
Definition: Ldp.h:103
inet::UdpSocket::isOpen
virtual bool isOpen() const override
Definition: UdpSocket.h:293
inet::TcpSocket::CONNECTED
@ CONNECTED
Definition: TcpSocket.h:153
LDP_HELLO_TRAFFIC
#define LDP_HELLO_TRAFFIC
Definition: Ldp.h:28
inet::IP_PROT_TCP
@ IP_PROT_TCP
Definition: IpProtocolId_m.h:94
inet::HELLO
@ HELLO
Definition: LdpPacket_m.h:77
inet::OperationalMixin< cSimpleModule >::delayActiveOperationFinish
virtual void delayActiveOperationFinish(simtime_t timeout)
Definition: OperationalMixinImpl.h:161
inet::Ldp::findPeerSocket
virtual TcpSocket * findPeerSocket(Ipv4Address peerAddr)
Utility: return socket for given peer, and nullptr if session doesn't exist.
Definition: Ldp.cc:1202
inet::Ldp::findPeerAddrFromInterface
virtual Ipv4Address findPeerAddrFromInterface(std::string interfaceName)
This method maps the peerIP with the interface name in routing table.
Definition: Ldp.cc:792
inet::OperationalMixin< cSimpleModule >::startActiveOperationExtraTimeOrFinish
virtual void startActiveOperationExtraTimeOrFinish(simtime_t extraTime)
Definition: OperationalMixinImpl.h:179
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
inet::routeDeletedSignal
simsignal_t routeDeletedSignal
Definition: Simsignals.cc:42
tags
* tags
Definition: IUdp-gates.txt:3
inet::Ldp::processNOTIFICATION
virtual void processNOTIFICATION(Ptr< const LdpPacket > &ldpPacket, bool rescheduled)
Definition: Ldp.cc:918
inet::Ldp::udpSockets
std::vector< UdpSocket > udpSockets
Definition: Ldp.h:114
inet::Ldp::tedmod
ModuleRefByPar< Ted > tedmod
Definition: Ldp.h:111
inet::Ldp::holdTime
simtime_t holdTime
Definition: Ldp.h:90
inet::Ldp::updateFecList
virtual void updateFecList(Ipv4Address nextHop)
Definition: Ldp.cc:453
inet::Ldp::findInterfaceFromPeerAddr
std::string findInterfaceFromPeerAddr(Ipv4Address peerIP)
Definition: Ldp.cc:828
inet::Ldp::udpSocket
UdpSocket udpSocket
Definition: Ldp.h:113
inet::Ldp::maxFecid
int maxFecid
Definition: Ldp.h:121
inet::TcpSocket::bind
void bind(int localPort)
Bind the socket to a local port number.
Definition: TcpSocket.cc:69
inet::Ldp::fecUp
FecBindVector fecUp
Definition: Ldp.h:96
inet::TcpSocket::setOutputGate
void setOutputGate(cGate *toTcp)
Sets the gate on which to send to TCP.
Definition: TcpSocket.h:242
inet::Ldp::sendMapping
virtual void sendMapping(int type, Ipv4Address dest, int label, Ipv4Address addr, int length)
Definition: Ldp.cc:897
inet::TcpSocket::close
void close() override
Closes the local end of the connection.
Definition: TcpSocket.cc:161
inet::UdpSocket::getSocketId
int getSocketId() const override
Returns the internal socket Id.
Definition: UdpSocket.h:108
inet::Ldp::findPeer
virtual int findPeer(Ipv4Address peerAddr)
Utility: return peer's index in myPeers table, or -1 if not found.
Definition: Ldp.cc:1193
inet::Ldp::sendHelloMsg
cMessage * sendHelloMsg
Definition: Ldp.h:119
inet::LibTable::popLabel
static LabelOpVector popLabel()
Definition: LibTable.cc:177
inet::Ldp::processLdpPacketFromTcp
virtual void processLdpPacketFromTcp(Ptr< const LdpPacket > &ldpPacket)
Definition: Ldp.cc:715
inet::INITSTAGE_ROUTING_PROTOCOLS
INET_API InitStage INITSTAGE_ROUTING_PROTOCOLS
Initialization of routing protocols.
inet::Ldp::sendMappingRequest
virtual void sendMappingRequest(Ipv4Address dest, Ipv4Address addr, int length)
Definition: Ldp.cc:268
inet::ADDRESS
@ ADDRESS
Definition: LdpPacket_m.h:80
inet::Ldp::openTCPConnectionToPeer
virtual void openTCPConnectionToPeer(int peerIndex)
Definition: Ldp.cc:615
inet::LABEL_REQUEST
@ LABEL_REQUEST
Definition: LdpPacket_m.h:83
inet::LABEL_MAPPING
@ LABEL_MAPPING
Definition: LdpPacket_m.h:82
inet::Ldp::helloInterval
simtime_t helloInterval
Definition: Ldp.h:91
inet::fecPrefixCompare
bool fecPrefixCompare(const Ldp::fec_t &a, const Ldp::fec_t &b)
Definition: Ldp.cc:36
LDP_PORT
#define LDP_PORT
Definition: Ldp.h:25