#include <ctype.h>
#include <stdio.h>
#include <functional>
Go to the source code of this file.
#define CHECK_AGE 300 |
Definition at line 30 of file OSPFcommon.h.
Referenced by OSPF::Router::AgeDatabase(), and OSPF::Area::AgeDatabase().
#define DEFAULT_DESTINATION_ADDRESS 0 |
Definition at line 33 of file OSPFcommon.h.
#define DEFAULT_DESTINATION_MASK 0 |
Definition at line 34 of file OSPFcommon.h.
#define INITIAL_SEQUENCE_NUMBER -2147483647 |
Definition at line 35 of file OSPFcommon.h.
Referenced by OSPF::Router::AgeDatabase(), OSPF::Area::AgeDatabase(), OSPF::Router::GetUniqueLinkStateID(), OSPF::Area::GetUniqueLinkStateID(), OSPF::Router::OriginateASExternalLSA(), OSPF::Area::OriginateNetworkLSA(), OSPF::Area::OriginateRouterLSA(), and OSPF::Router::UpdateExternalRoute().
#define IPV4_DATAGRAM_LENGTH 65536 |
Definition at line 40 of file OSPFcommon.h.
Referenced by OSPF::Neighbor::RetransmitUpdatePacket(), OSPF::Neighbor::SendDatabaseDescriptionPacket(), OSPF::Interface::SendDelayedAcknowledgements(), and OSPF::Neighbor::SendLinkStateRequestPacket().
#define IPV4_HEADER_LENGTH 60 |
Definition at line 39 of file OSPFcommon.h.
Referenced by OSPF::Neighbor::RetransmitUpdatePacket(), OSPF::Neighbor::SendDatabaseDescriptionPacket(), OSPF::Interface::SendDelayedAcknowledgements(), and OSPF::Neighbor::SendLinkStateRequestPacket().
#define LS_INFINITY 16777215 |
Definition at line 32 of file OSPFcommon.h.
#define LS_REFRESH_TIME 1800 |
Definition at line 26 of file OSPFcommon.h.
Referenced by OSPF::Router::AgeDatabase(), and OSPF::Area::AgeDatabase().
#define MAX_AGE 3600 |
Definition at line 29 of file OSPFcommon.h.
Referenced by OSPF::Router::AgeDatabase(), OSPF::Area::AgeDatabase(), OSPF::NeighborState::ChangeState(), OSPF::InterfaceState::ChangeState(), OSPF::Interface::CreateUpdatePacket(), OSPF::Router::InstallASExternalLSA(), operator<(), operator==(), OSPF::LinkStateUpdateHandler::ProcessPacket(), OSPF::HelloHandler::ProcessPacket(), OSPF::Router::RemoveExternalRoute(), and OSPF::Neighbor::RetransmitUpdatePacket().
#define MAX_AGE_DIFF 900 |
Definition at line 31 of file OSPFcommon.h.
Referenced by operator<(), and operator==().
#define MAX_SEQUENCE_NUMBER 2147483647 |
Definition at line 36 of file OSPFcommon.h.
Referenced by OSPF::Router::AgeDatabase(), OSPF::Area::AgeDatabase(), OSPF::NeighborState::ChangeState(), OSPF::InterfaceState::ChangeState(), OSPF::Router::GetUniqueLinkStateID(), OSPF::Area::GetUniqueLinkStateID(), OSPF::LinkStateUpdateHandler::ProcessPacket(), and OSPF::HelloHandler::ProcessPacket().
#define MIN_LS_ARRIVAL 1 |
Definition at line 28 of file OSPFcommon.h.
Referenced by OSPF::Neighbor::AgeTransmittedLSAList().
#define MIN_LS_INTERVAL 5 |
Definition at line 27 of file OSPFcommon.h.
#define OSPF_ASEXTERNALLSA_HEADER_LENGTH 16 |
Definition at line 51 of file OSPFcommon.h.
Referenced by CalculateLSASize().
#define OSPF_ASEXTERNALLSA_TOS_INFO_LENGTH 12 |
Definition at line 52 of file OSPFcommon.h.
#define OSPF_DD_HEADER_LENGTH 8 |
Definition at line 43 of file OSPFcommon.h.
Referenced by OSPF::Neighbor::SendDatabaseDescriptionPacket().
#define OSPF_HEADER_LENGTH 24 |
Definition at line 41 of file OSPFcommon.h.
Referenced by OSPF::Neighbor::SendDatabaseDescriptionPacket(), OSPF::Interface::SendDelayedAcknowledgements(), and OSPF::Neighbor::SendLinkStateRequestPacket().
#define OSPF_LINK_HEADER_LENGTH 12 |
Definition at line 46 of file OSPFcommon.h.
Referenced by CalculateLSASize().
#define OSPF_LSA_HEADER_LENGTH 20 |
Definition at line 42 of file OSPFcommon.h.
Referenced by CalculateLSASize(), and OSPF::Neighbor::SendDatabaseDescriptionPacket().
#define OSPF_NETWORKLSA_ADDRESS_LENGTH 4 |
Definition at line 49 of file OSPFcommon.h.
#define OSPF_NETWORKLSA_MASK_LENGTH 4 |
Definition at line 48 of file OSPFcommon.h.
Referenced by CalculateLSASize().
#define OSPF_REQUEST_LENGTH 12 |
Definition at line 44 of file OSPFcommon.h.
Referenced by OSPF::Neighbor::SendLinkStateRequestPacket().
#define OSPF_ROUTERLSA_HEADER_LENGTH 4 |
Definition at line 45 of file OSPFcommon.h.
#define OSPF_SUMMARYLSA_HEADER_LENGTH 8 |
Definition at line 50 of file OSPFcommon.h.
Referenced by CalculateLSASize().
#define OSPF_TOS_LENGTH 4 |
Definition at line 47 of file OSPFcommon.h.
#define VIRTUAL_LINK_TTL 32 |
Definition at line 38 of file OSPFcommon.h.
Referenced by OSPF::LinkStateUpdateHandler::AcknowledgeLSA(), OSPF::Interface::FloodLSA(), OSPF::NeighborStateDown::ProcessEvent(), OSPF::InterfaceStateWaiting::ProcessEvent(), OSPF::InterfaceStateDesignatedRouter::ProcessEvent(), OSPF::InterfaceStateBackup::ProcessEvent(), OSPF::LinkStateUpdateHandler::ProcessPacket(), OSPF::LinkStateRequestHandler::ProcessPacket(), OSPF::Neighbor::RetransmitDatabaseDescriptionPacket(), OSPF::Neighbor::RetransmitUpdatePacket(), OSPF::Neighbor::SendDatabaseDescriptionPacket(), OSPF::Interface::SendDelayedAcknowledgements(), OSPF::Neighbor::SendLinkStateRequestPacket(), and OSPF::Interface::SendLSAcknowledgement().
char* AddressStringFromIPv4Address | ( | char * | buffer, | |
int | bufferLength, | |||
OSPF::IPv4Address | byteForm | |||
) | [inline] |
Definition at line 291 of file OSPFcommon.h.
Referenced by OSPF::Area::detailedInfo(), operator<<(), OSPF::MessageHandler::PrintDatabaseDescriptionPacket(), OSPF::MessageHandler::PrintHelloPacket(), OSPF::MessageHandler::PrintLinkStateAcknowledgementPacket(), OSPF::MessageHandler::PrintLinkStateRequestPacket(), and OSPF::MessageHandler::PrintLinkStateUpdatePacket().
char* AddressStringFromULong | ( | char * | buffer, | |
int | bufferLength, | |||
unsigned long | longForm | |||
) | [inline] |
Definition at line 302 of file OSPFcommon.h.
Referenced by OSPF::Area::detailedInfo(), OSPF::Area::info(), OSPF::MessageHandler::PrintEvent(), OSPF::MessageHandler::PrintHelloPacket(), OSPF::MessageHandler::PrintLinkStateRequestPacket(), OSPF::MessageHandler::PrintLinkStateUpdatePacket(), PrintLSAHeader(), and OSPF::LinkStateRequestHandler::ProcessPacket().
{ if (bufferLength < 16) { buffer = '\0'; } else { sprintf(buffer, "%d.%d.%d.%d", (int)((longForm & 0xFF000000) >> 24), (int)((longForm & 0x00FF0000) >> 16), (int)((longForm & 0x0000FF00) >> 8), (int)(longForm & 0x000000FF)); } return buffer; }
char HexCharToByte | ( | char | hex | ) | [inline] |
Definition at line 316 of file OSPFcommon.h.
Referenced by HexPairToByte().
{ switch (hex) { case '0': return 0; case '1': return 1; case '2': return 2; case '3': return 3; case '4': return 4; case '5': return 5; case '6': return 6; case '7': return 7; case '8': return 8; case '9': return 9; case 'A': return 10; case 'B': return 11; case 'C': return 12; case 'D': return 13; case 'E': return 14; case 'F': return 15; case 'a': return 10; case 'b': return 11; case 'c': return 12; case 'd': return 13; case 'e': return 14; case 'f': return 15; default: return 0; }; }
char HexPairToByte | ( | char | upperHex, | |
char | lowerHex | |||
) | [inline] |
Definition at line 345 of file OSPFcommon.h.
Referenced by OSPFRouting::LoadExternalRoute(), OSPFRouting::LoadInterfaceParameters(), and OSPFRouting::LoadVirtualLink().
{ return ((HexCharToByte(upperHex) << 4) & (HexCharToByte(lowerHex))); }
OSPF::IPv4Address IPv4AddressFromAddressString | ( | const char * | charForm | ) | [inline] |
Definition at line 224 of file OSPFcommon.h.
Referenced by OSPFRouting::LoadAreaFromXML(), OSPFRouting::LoadExternalRoute(), OSPFRouting::LoadHostRoute(), OSPFRouting::LoadInterfaceParameters(), OSPF::Interface::SetIfIndex(), and ULongFromAddressString().
{ OSPF::IPv4Address byteForm = OSPF::NullIPv4Address; int lastDot = -1; int byteCount = 0; for (int i = 0; i < 16; i++) { if (charForm[i] == '\0') { if ((byteCount <= 3) && (i - lastDot - 1 <= 3)) { switch (i - lastDot - 1) { case 3: byteForm.bytes[byteCount] += (((charForm[i - 3] - '0') < 3) ? (charForm[i - 3] - '0') : 0) * 100; case 2: byteForm.bytes[byteCount] += (charForm[i - 2] - '0') * 10; case 1: byteForm.bytes[byteCount] += charForm[i - 1] - '0'; default: break; } } break; } if ((!isdigit(charForm[i])) && (charForm[i] != '.')) { break; } if (charForm[i] == '.') { if (i == 0) { break; } if (i - lastDot - 1 > 3) { break; } switch (i - lastDot - 1) { case 3: byteForm.bytes[byteCount] += (((charForm[i - 3] - '0') < 3) ? (charForm[i - 3] - '0') : 0) * 100; case 2: byteForm.bytes[byteCount] += (charForm[i - 2] - '0') * 10; case 1: byteForm.bytes[byteCount] += charForm[i - 1] - '0'; default: break; } byteCount++; lastDot = i; if (byteCount > 3) { break; } } } return byteForm; }
OSPF::IPv4Address IPv4AddressFromULong | ( | unsigned long | longForm | ) | [inline] |
Definition at line 269 of file OSPFcommon.h.
Referenced by OSPF::Area::AgeDatabase(), OSPF::Area::CalculateNextHops(), OSPF::Area::CreateRoutingTableEntryFromSummaryLSA(), OSPF::Area::FindSameOrWorseCostRoute(), OSPF::Router::GetUniqueLinkStateID(), OSPF::Area::GetUniqueLinkStateID(), OSPF::MessageHandler::ProcessPacket(), OSPF::LinkStateUpdateHandler::ProcessPacket(), and OSPF::HelloHandler::ProcessPacket().
{ OSPF::IPv4Address byteForm; byteForm.bytes[0] = (longForm & 0xFF000000) >> 24; byteForm.bytes[1] = (longForm & 0x00FF0000) >> 16; byteForm.bytes[2] = (longForm & 0x0000FF00) >> 8; byteForm.bytes[3] = longForm & 0x000000FF; return byteForm; }
bool operator!= | ( | OSPF::IPv4AddressRange | leftAddressRange, | |
OSPF::IPv4AddressRange | rightAddressRange | |||
) | [inline] |
Definition at line 189 of file OSPFcommon.h.
{
return (!(leftAddressRange == rightAddressRange));
}
bool operator!= | ( | OSPF::DesignatedRouterID | leftID, | |
OSPF::DesignatedRouterID | rightID | |||
) | [inline] |
Definition at line 200 of file OSPFcommon.h.
{
return (!(leftID == rightID));
}
bool operator!= | ( | OSPF::IPv4Address | leftAddress, | |
OSPF::IPv4Address | rightAddress | |||
) | [inline] |
Definition at line 138 of file OSPFcommon.h.
{
return (!(leftAddress == rightAddress));
}
OSPF::IPv4Address operator& | ( | OSPF::IPv4Address | address, | |
OSPF::IPv4Address | mask | |||
) | [inline] |
Definition at line 163 of file OSPFcommon.h.
bool operator< | ( | OSPF::IPv4Address | leftAddress, | |
OSPF::IPv4Address | rightAddress | |||
) | [inline] |
Definition at line 143 of file OSPFcommon.h.
bool operator<= | ( | OSPF::IPv4Address | leftAddress, | |
OSPF::IPv4Address | rightAddress | |||
) | [inline] |
Definition at line 148 of file OSPFcommon.h.
{
return ((leftAddress < rightAddress) || (leftAddress == rightAddress));
}
bool operator== | ( | OSPF::IPv4Address | leftAddress, | |
OSPF::IPv4Address | rightAddress | |||
) | [inline] |
bool operator== | ( | OSPF::IPv4AddressRange | leftAddressRange, | |
OSPF::IPv4AddressRange | rightAddressRange | |||
) | [inline] |
bool operator== | ( | OSPF::DesignatedRouterID | leftID, | |
OSPF::DesignatedRouterID | rightID | |||
) | [inline] |
Definition at line 194 of file OSPFcommon.h.
{ return (leftID.routerID == rightID.routerID && leftID.ipInterfaceAddress == rightID.ipInterfaceAddress); }
bool operator> | ( | OSPF::IPv4Address | leftAddress, | |
OSPF::IPv4Address | rightAddress | |||
) | [inline] |
Definition at line 153 of file OSPFcommon.h.
{
return (!(leftAddress <= rightAddress));
}
bool operator>= | ( | OSPF::IPv4Address | leftAddress, | |
OSPF::IPv4Address | rightAddress | |||
) | [inline] |
Definition at line 158 of file OSPFcommon.h.
{
return (!(leftAddress < rightAddress));
}
OSPF::IPv4Address operator| | ( | OSPF::IPv4Address | address, | |
OSPF::IPv4Address | match | |||
) | [inline] |
Definition at line 173 of file OSPFcommon.h.
unsigned long ULongFromAddressString | ( | const char * | charForm | ) | [inline] |
Definition at line 286 of file OSPFcommon.h.
Referenced by OSPFRouting::LoadAreaFromXML(), OSPFRouting::LoadExternalRoute(), OSPFRouting::LoadHostRoute(), OSPFRouting::LoadInterfaceParameters(), and OSPFRouting::LoadVirtualLink().
{ return ULongFromIPv4Address(IPv4AddressFromAddressString(charForm)); }
unsigned long ULongFromIPv4Address | ( | OSPF::IPv4Address | byteForm | ) | [inline] |
Definition at line 281 of file OSPFcommon.h.
Referenced by OSPF::Area::CalculateNextHops(), OSPF::NeighborState::ChangeState(), OSPF::InterfaceState::ChangeState(), OSPF::Area::CreateRoutingTableEntryFromSummaryLSA(), OSPF::Area::FindSameOrWorseCostRoute(), OSPF::Router::GetUniqueLinkStateID(), OSPF::Area::GetUniqueLinkStateID(), OSPFRouting::LoadExternalRoute(), OSPF::Area::OriginateNetworkLSA(), OSPF::Area::OriginateRouterLSA(), OSPF::MessageHandler::ProcessPacket(), OSPF::HelloHandler::ProcessPacket(), OSPF::Router::RemoveExternalRoute(), OSPF::Interface::SendHelloPacket(), OSPF::MessageHandler::SendPacket(), ULongFromAddressString(), and OSPF::Router::UpdateExternalRoute().