Classes | Namespaces | Functions

OSPFRoutingTableEntry.h File Reference

#include "IRoutingTable.h"
#include "InterfaceTableAccess.h"
#include "OSPFcommon.h"
#include <memory.h>

Go to the source code of this file.

Classes

class  OSPF::RoutingTableEntry

Namespaces

namespace  OSPF

Functions

std::ostream & operator<< (std::ostream &out, const OSPF::RoutingTableEntry &entry)

Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const OSPF::RoutingTableEntry entry 
) [inline]

Definition at line 195 of file OSPFRoutingTableEntry.h.

{
    out << "Destination: "
        << entry.GetDestinationID().str()
        << "/"
        << entry.GetAddressMask().str()
        << " (";
    if (entry.GetDestinationType() == OSPF::RoutingTableEntry::NetworkDestination) {
        out << "Network";
    } else {
        if ((entry.GetDestinationType() & OSPF::RoutingTableEntry::AreaBorderRouterDestination) != 0) {
            out << "AreaBorderRouter";
        }
        if ((entry.GetDestinationType() & (OSPF::RoutingTableEntry::ASBoundaryRouterDestination | OSPF::RoutingTableEntry::AreaBorderRouterDestination)) != 0) {
            out << "+";
        }
        if ((entry.GetDestinationType() & OSPF::RoutingTableEntry::ASBoundaryRouterDestination) != 0) {
            out << "ASBoundaryRouter";
        }
    }
    out << "), Area: "
        << entry.GetArea()
        << ", PathType: ";
    switch (entry.GetPathType()) {
        case OSPF::RoutingTableEntry::IntraArea:     out << "IntraArea";     break;
        case OSPF::RoutingTableEntry::InterArea:     out << "InterArea";     break;
        case OSPF::RoutingTableEntry::Type1External: out << "Type1External"; break;
        case OSPF::RoutingTableEntry::Type2External: out << "Type2External"; break;
        default:            out << "Unknown";       break;
    }
    out << ", Cost: "
        << entry.GetCost()
        << ", Type2Cost: "
        << entry.GetType2Cost()
        << ", Origin: [";
    PrintLSAHeader(entry.GetLinkStateOrigin()->getHeader(), out);
    out << "], NextHops: ";

    unsigned int hopCount = entry.GetNextHopCount();
    for (unsigned int i = 0; i < hopCount; i++) {
        char addressString[16];
        out << AddressStringFromIPv4Address(addressString, sizeof(addressString), entry.GetNextHop(i).hopAddress)
            << " ";
    }

    return out;
}