44 OSPFLinkStateRequestPacket *lsRequestPacket = check_and_cast<OSPFLinkStateRequestPacket *>(packet);
46 unsigned long requestCount = lsRequestPacket->getRequestsArraySize();
48 std::vector<OSPFLSA *> lsas;
50 EV_INFO <<
" Processing packet contents:\n";
52 for (
unsigned long i = 0; i < requestCount; i++) {
53 LSARequest& request = lsRequestPacket->getRequests(i);
56 EV_INFO <<
" LSARequest: type=" << request.lsType
57 <<
", LSID=" << request.linkStateID
58 <<
", advertisingRouter=" << request.advertisingRouter
61 lsaKey.linkStateID = request.linkStateID;
62 lsaKey.advertisingRouter = request.advertisingRouter;
64 OSPFLSA *lsaInDatabase =
router->
findLSA(static_cast<LSAType>(request.lsType), lsaKey, intf->getArea()->getAreaID());
66 if (lsaInDatabase !=
nullptr) {
67 lsas.push_back(lsaInDatabase);
77 int updatesCount = lsas.size();
81 for (
int j = 0; j < updatesCount; j++) {
82 OSPFLinkStateUpdatePacket *updatePacket = intf->createUpdatePacket(lsas[j]);
83 if (updatePacket !=
nullptr) {
100 messageHandler->sendPacket(updatePacket, neighbor->getAddress(), intf->getIfIndex(),
ttl);
#define VIRTUAL_LINK_TTL
Definition: OSPFcommon.h:45
void printEvent(const char *eventString, const Interface *onInterface=nullptr, const Neighbor *forNeighbor=nullptr) const
Definition: MessageHandler.cc:377
Definition: OSPFInterface.h:60
Router * router
Definition: IMessageHandler.h:35
Definition: OSPFNeighbor.h:47
NeighborStateType
Definition: OSPFNeighbor.h:61
Definition: OSPFInterface.h:56
Definition: OSPFNeighbor.h:68
Definition: OSPFInterface.h:70
const DesignatedRouterID NULL_DESIGNATEDROUTERID
Definition: OSPFcommon.h:164
Definition: OSPFInterface.h:57
OSPFLSA * findLSA(LSAType lsaType, LSAKeyType lsaKey, AreaID areaID)
Find the LSA identified by the input lsaKey in the database.
Definition: OSPFRouter.cc:230
Definition: OSPFInterface.h:69
void sendPacket(OSPFPacket *packet, IPv4Address destination, int outputIfIndex, short ttl=1)
Definition: MessageHandler.cc:305
Definition: OSPFNeighbor.h:69
MessageHandler * getMessageHandler()
Definition: OSPFRouter.h:77
Definition: OSPFNeighbor.h:67
static const IPv4Address ALL_OSPF_DESIGNATED_ROUTERS_MCAST
224.0.0.6 All OSPF Designated Routers
Definition: IPv4Address.h:111
uint8_t ttl
Definition: TCP_NSC.cc:87
static const IPv4Address ALL_OSPF_ROUTERS_MCAST
224.0.0.5 All OSPF routers (DR Others)
Definition: IPv4Address.h:110