A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages

Modules

 Assert
 assert functions and macros
 
 Fatal Error Handler
 Functions to help clean up when fatal error is encountered.
 
 Logging
 Logging functions and macros.
 

Macros

#define NS_ABORT_IF(cond)
 Abnormal program termination if cond is true. More...
 
#define NS_ABORT_MSG(msg)
 Abnormal program termination. More...
 
#define NS_ABORT_MSG_IF(cond, msg)
 Abnormal program termination if cond is true. More...
 
#define NS_ABORT_MSG_UNLESS(cond, msg)   NS_ABORT_MSG_IF (!(cond),msg)
 Abnormal program termination if cond is false. More...
 
#define NS_ABORT_UNLESS(cond)   NS_ABORT_IF (!(cond))
 Abnormal program termination if cond is false. More...
 
#define NS_BREAKPOINT()   ns3::BreakpointFallback ()
 
#define NS_FATAL_ERROR(msg)
 fatal error handling More...
 
#define NS_FATAL_ERROR_NO_MSG()
 fatal error handling More...
 

Detailed Description

Macro Definition Documentation

#define NS_ABORT_IF (   cond)
Value:
do { \
if (cond) \
{ \
std::cerr << "aborted. cond=\"" << # cond << ", "; \
} \
} while (false)
#define NS_FATAL_ERROR_NO_MSG()
fatal error handling
Definition: fatal-error.h:44

Abnormal program termination if cond is true.

Parameters
condcondition to be evaluated.

This is similar to NS_ASSERT(!(cond)), except this check is enabled in all builds. If cond is evaluated to true, the espression evaluating to true is printed to stderr, followed by a call to the NS_FATAL_ERROR_NO_MSG() macro which prints the details of filename and line number to stderr. The program will be halted by calling std::terminate(), triggering any clean up code registered by std::set_terminate (NS3 default is a stream-flushing code, but may be overridden).

This macro is enable unconditionally in all builds, including debug and optimized builds.

Definition at line 69 of file abort.h.

Referenced by ns3::EpcTft::Add(), ns3::LteEpcE2eDataTestCase::DoRun(), and ns3::UeManager::GetDataRadioBearerInfo().

#define NS_ABORT_MSG (   msg)
Value:
do { \
std::cerr << "aborted. "; \
} while (false)
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:72

Abnormal program termination.

Parameters
msgmessage to output when this macro is hit.

This macro is essentially equivalent to NS_FATAL_ERROR, excepts it prepends the error message with the string "aborted. ". When this macro is hit a runtime, the program will be halted using std::terminate, which triggers clean up code regestered by std::set_terminate.

This macro is enable unconditionally in all builds, including debug and optimized builds.

See Also
NS_FATAL_ERROR

Definition at line 43 of file abort.h.

Referenced by ns3::YansWifiPhyHelper::SetPcapDataLinkType(), and ns3::Time::Time().

#define NS_ABORT_MSG_IF (   cond,
  msg 
)
Value:
do { \
if (cond) \
{ \
std::cerr << "aborted. cond=\"" << # cond << "\", "; \
} \
} while (false)
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:72

Abnormal program termination if cond is true.

Parameters
condcondition to be evaluated.
msgmessage to output when cond is true.

This is similar to NS_ASSERT_MSG(!(cond)), except this check is enabled in all builds. If cond is evaluated to true, the espression evaluating to true is printed to stderr, followed by a call to the NS_FATAL_ERROR() macro which prints the user-specified error message, and details of filename and line number to stderr. The program will be halted by calling std::terminate(), triggering any clean up code registered by std::set_terminate (NS3 default is a stream-flushing code, but may be overridden).

This macro is enable unconditionally in all builds, including debug and optimized builds.

Definition at line 98 of file abort.h.

Referenced by ns3::WaypointMobilityModel::AddWaypoint(), ns3::PcapHelper::CreateFile(), ns3::PlanetLabFdNetDeviceHelper::CreateFileDescriptor(), ns3::TapFdNetDeviceHelper::CreateFileDescriptor(), ns3::TapBridge::CreateTap(), ns3::GlobalRouter::DiscoverLSAs(), ns3::TapBridgeFdReader::DoRead(), ns3::FdNetDeviceFdReader::DoRead(), ns3::AsciiTraceHelperForDevice::EnableAsciiImpl(), ns3::PcapHelperForDevice::EnablePcap(), ns3::YansWifiPhyHelper::EnablePcapInternal(), ns3::RadioEnvironmentMapHelper::Install(), ns3::AthstatsWifiTraceSink::Open(), ns3::TcpSocketBase::Recv(), ns3::TcpSocketBase::Send(), ns3::Ipv4Header::SetFragmentOffset(), and ns3::TapBridge::StartTapDevice().

#define NS_ABORT_UNLESS (   cond)    NS_ABORT_IF (!(cond))

Abnormal program termination if cond is false.

Parameters
condcondition to be evaluated.

This is an alias for NS_ABORT_IF(!(cond))

See Also
NS_ABORT_IF

Definition at line 117 of file abort.h.

#define NS_BREAKPOINT ( )    ns3::BreakpointFallback ()

Inserts a breakpoint instruction (or equivalent system call) into the code for selected machines. When an NS_ASSERT cannot verify its condition, this macro is used. Falls back to calling AssertBreakpoint() for architectures where breakpoint assembly instructions are not supported.

Definition at line 56 of file breakpoint.h.

#define NS_FATAL_ERROR (   msg)
Value:
do \
{ \
std::cerr << "msg=\"" << msg << "\", "; \
} \
while (false)
#define NS_FATAL_ERROR_NO_MSG()
fatal error handling
Definition: fatal-error.h:44

fatal error handling

Parameters
msgmessage to output when this macro is hit.

When this macro is hit at runtime, the user-specified error message is printed to stderr, followed by a call to the NS_FATAL_ERROR_NO_MSG() macro which prints the details of filename and line number to stderr. The program will be halted by calling std::terminate(), triggering any clean up code registered by std::set_terminate (NS3 default is a stream-flushing code, but may be overridden).

This macro is enabled unconditionally in all builds, including debug and optimized builds.

Definition at line 72 of file fatal-error.h.

Referenced by ns3::EpcUeNas::ActivateEpsBearer(), ns3::Ipv6L3Protocol::AddAutoconfiguredAddress(), ns3::BridgeNetDevice::AddBridgePort(), ns3::ConnectionManager::AddConnection(), ns3::UeManager::AddDataRadioBearerInfo(), ns3::CsmaNetDevice::AddHeader(), ns3::MeshPointDevice::AddInterface(), ns3::WimaxNetDevice::AddLinkChangeCallback(), ns3::NixVector::AddNeighborIndex(), ns3::TestCase::AddTestCase(), ns3::Object::AggregateObject(), ns3::GlobalValue::Bind(), ns3::BriteTopologyHelper::BuildBriteEdgeInfoList(), ns3::BriteTopologyHelper::BuildBriteNodeInfoList(), ns3::Building::Building(), ns3::AcousticModemEnergyModel::ChangeState(), ns3::WifiRadioEnergyModel::ChangeState(), ns3::WimaxHelper::CreateBSScheduler(), ns3::ConnectionManager::CreateConnection(), ns3::EmuFdNetDeviceHelper::CreateFileDescriptor(), ns3::PlanetLabFdNetDeviceHelper::CreateFileDescriptor(), ns3::TapFdNetDeviceHelper::CreateFileDescriptor(), ns3::WimaxHelper::CreatePhy(), ns3::WimaxHelper::CreatePhyWithoutChannel(), ns3::EmuNetDevice::CreateSocket(), ns3::TapBridge::CreateTap(), ns3::WimaxHelper::CreateUplinkScheduler(), ns3::WifiModeFactory::CreateWifiMode(), ns3::CtrlBAckRequestHeader::Deserialize(), ns3::dot11s::PeerLinkFrameStart::Deserialize(), ns3::Tlv::Deserialize(), ns3::CtrlBAckResponseHeader::Deserialize(), ns3::ObjectPtrContainerValue::DeserializeFromString(), ns3::dot11s::IeConfiguration::DeserializeInformationField(), ns3::MeshInformationElementVector::DeserializeSingleIe(), ns3::WifiInformationElementVector::DeserializeSingleIe(), ns3::MpiInterface::Disable(), ns3::AcousticModemEnergyModel::DoGetCurrentA(), ns3::WifiRadioEnergyModel::DoGetCurrentA(), ns3::UeManager::DoInitialize(), ns3::olsr::RoutingProtocol::DoInitialize(), ns3::RvBatteryModelHelper::DoInstall(), ns3::BasicEnergySourceHelper::DoInstall(), ns3::AcousticModemEnergyModelHelper::DoInstall(), ns3::WifiRadioEnergyModelHelper::DoInstall(), ns3::LenaMimoTestCase::DoRun(), Ns3TcpLossTestCase::DoRun(), Ns3TcpStateTestCase::DoRun(), ns3::MpiInterface::Enable(), ns3::RegularWifiMac::Enqueue(), ns3::BlockAckManager::ExistsAgreementInState(), ns3::NixVector::ExtractNeighborIndex(), ns3::Ipv4FlowClassifier::FindFlow(), ns3::SystemPath::FindSelfDirectory(), ns3::RegularWifiMac::FinishConfigureStandard(), ns3::EmuNetDevice::ForwardUp(), ns3::CidFactory::FreeCid(), ns3::ObjectBase::GetAttribute(), ns3::EmuNetDevice::GetChannel(), ns3::LteSpectrumValueHelper::GetChannelBandwidth(), ns3::ConnectionManager::GetConnections(), ns3::WifiRemoteStationManager::GetControlAnswerMode(), ns3::MultiModelSpectrumChannel::GetDevice(), ns3::MeshPointDevice::GetInterface(), ns3::PointToPointGridHelper::GetIpv4Address(), ns3::PointToPointGridHelper::GetIpv6Address(), ns3::EmuNetDevice::GetMtu(), ns3::UanNetDevice::GetMulticast(), ns3::LteEnbRrc::GetNewSrsConfigurationIndex(), ns3::PointToPointGridHelper::GetNode(), ns3::EpsBearer::GetPacketDelayBudgetMs(), ns3::EpsBearer::GetPacketErrorLossRate(), ns3::UanPhyDual::GetPacketRx(), ns3::WifiPhy::GetPayloadDurationMicroSeconds(), ns3::WifiPhy::GetPlcpHeaderDurationMicroSeconds(), ns3::WifiPhy::GetPlcpHeaderMode(), ns3::WifiPhy::GetPlcpPreambleDurationMicroSeconds(), ns3::EpsBearer::GetPriority(), ns3::Ipv4ListRouting::GetRoutingProtocol(), ns3::Ipv6ListRouting::GetRoutingProtocol(), ns3::CtrlBAckRequestHeader::GetSerializedSize(), ns3::CtrlBAckResponseHeader::GetSerializedSize(), ns3::ByteTagIterator::Item::GetTag(), ns3::GlobalValue::GetValue(), ns3::GlobalValue::GetValueByName(), ns3::GlobalValue::GlobalValue(), ns3::RrFfMacScheduler::HarqProcessAvailability(), ns3::FdMtFfMacScheduler::HarqProcessAvailability(), ns3::TdMtFfMacScheduler::HarqProcessAvailability(), ns3::TtaFfMacScheduler::HarqProcessAvailability(), ns3::PfFfMacScheduler::HarqProcessAvailability(), ns3::FdBetFfMacScheduler::HarqProcessAvailability(), ns3::TdBetFfMacScheduler::HarqProcessAvailability(), ns3::FdTbfqFfMacScheduler::HarqProcessAvailability(), ns3::TdTbfqFfMacScheduler::HarqProcessAvailability(), ns3::PssFfMacScheduler::HarqProcessAvailability(), ns3::RadioEnvironmentMapHelper::Install(), ns3::InternetStackHelper::Install(), ns3::MeshHelper::Install(), ns3::MobilityHelper::Install(), ns3::IpcsClassifierRecord::IpcsClassifierRecord(), ns3::EpsBearer::IsGbr(), ns3::olsr::RoutingProtocol::LinkSensing(), ns3::LogComponentEnable(), ns3::ArpL3Protocol::Lookup(), ns3::LteEnbPhy::LteEnbPhy(), ns3::LtePhy::LtePhy(), ns3::LteTestUePhy::LteTestUePhy(), ns3::LteUePhy::LteUePhy(), ns3::Ipv6AddressHelper::NewAddress(), ns3::BlockAckManager::NotifyGotBlockAck(), ns3::WifiRadioEnergyModelPhyListener::NotifyMaybeCcaBusyStart(), ns3::WifiRadioEnergyModelPhyListener::NotifyRxEndError(), ns3::WifiRadioEnergyModelPhyListener::NotifyRxEndOk(), ns3::WifiRadioEnergyModelPhyListener::NotifyRxStart(), ns3::WifiRadioEnergyModelPhyListener::NotifySensingStart(), ns3::WifiRadioEnergyModelPhyListener::NotifySwitchingStart(), ns3::WifiRadioEnergyModelPhyListener::NotifyTxStart(), ns3::Ns2MobilityHelper::Ns2MobilityHelper(), ns3::operator<<(), ns3::PointToPointGridHelper::PointToPointGridHelper(), ns3::UeManager::PrepareHandover(), ns3::WifiMacHeader::Print(), ns3::SystemPath::ReadFiles(), ns3::EmuNetDevice::ReadThread(), ns3::flame::FlameProtocolMac::Receive(), ns3::RegularWifiMac::Receive(), ns3::dsr::DsrRouting::Receive(), ns3::dot11s::HwmpProtocolMac::ReceiveData(), ns3::LteEnbPhy::ReceiveLteControlMessage(), ns3::MpiInterface::ReceiveMessages(), ns3::MacLow::ReceiveOk(), ns3::UeManager::RecvHandoverPreparationFailure(), ns3::RrFfMacScheduler::RefreshHarqProcesses(), ns3::FdMtFfMacScheduler::RefreshHarqProcesses(), ns3::TdMtFfMacScheduler::RefreshHarqProcesses(), ns3::TtaFfMacScheduler::RefreshHarqProcesses(), ns3::PfFfMacScheduler::RefreshHarqProcesses(), ns3::FdBetFfMacScheduler::RefreshHarqProcesses(), ns3::TdBetFfMacScheduler::RefreshHarqProcesses(), ns3::FdTbfqFfMacScheduler::RefreshHarqProcesses(), ns3::TdTbfqFfMacScheduler::RefreshHarqProcesses(), ns3::PssFfMacScheduler::RefreshHarqProcesses(), ns3::dot11s::HwmpProtocol::RemoveRoutingStuff(), ns3::flame::FlameProtocol::RemoveRoutingStuff(), ns3::dot11s::HwmpProtocol::RequestRoute(), ns3::flame::FlameProtocol::RequestRoute(), ns3::dsr::DsrOptions::ReverseSearchNextTwoHop(), ns3::olsr::RoutingProtocol::RouteInput(), ns3::olsr::RoutingProtocol::RouteOutput(), ns3::DistributedSimulatorImpl::Run(), ns3::Timer::Schedule(), ns3::BlockAckManager::ScheduleBlockAckReqIfNeeded(), ns3::UeManager::ScheduleRrcConnectionReconfiguration(), ns3::Ipv4L3Protocol::Send(), ns3::TapBridge::Send(), ns3::UeManager::SendData(), ns3::LteNetDevice::SendFrom(), ns3::EmuNetDevice::SendFrom(), ns3::TapBridge::SendFrom(), ns3::olsr::RoutingProtocol::SendHello(), ns3::MeshWifiInterfaceMac::SendManagementFrame(), ns3::MpiInterface::SendPacket(), ns3::UeManager::SendUeContextRelease(), ns3::CtrlBAckRequestHeader::Serialize(), ns3::CtrlBAckResponseHeader::Serialize(), ns3::EnumValue::SerializeToString(), ns3::ObjectFactory::Set(), ns3::Watchdog::SetArguments(), ns3::Timer::SetArguments(), ns3::ObjectBase::SetAttribute(), ns3::RadioEnvironmentMapHelper::SetBandwidth(), ns3::TapBridge::SetBridgedNetDevice(), ns3::EmuNetDevice::SetDataRate(), ns3::Config::SetDefault(), ns3::LteEnbNetDevice::SetDlBandwidth(), ns3::EmuFdNetDeviceHelper::SetFileDescriptor(), ns3::Simulator::SetImplementation(), ns3::AcousticModemEnergyModel::SetMicroModemState(), ns3::EmuNetDevice::SetMtu(), ns3::AnimationInterface::SetNodeColor(), ns3::AnimationInterface::SetNodeDescription(), ns3::AnimationInterface::SetOutputFile(), ns3::LteEnbRrc::SetSrsPeriodicity(), ns3::MeshHelper::SetStackInstaller(), ns3::LteEnbNetDevice::SetUlBandwidth(), ns3::TcpSocketBase::SetupEndpoint(), ns3::FdReader::Start(), ns3::UdpEchoServer::StartApplication(), ns3::BulkSendApplication::StartApplication(), ns3::PacketSink::StartApplication(), ns3::EmuNetDevice::StartDevice(), ns3::LteEnbPhy::StartSubFrame(), ns3::LteSpectrumPhy::StartTxDataFrame(), ns3::LteSpectrumPhy::StartTxDlCtrlFrame(), ns3::LteSpectrumPhy::StartTxUlSrsFrame(), BasicEnergyUpdateTest::StateSwitchTest(), ns3::WifiRadioEnergyModelPhyListener::SwitchToIdle(), ns3::UeManager::SwitchToState(), ns3::MpiInterface::TestSendComplete(), ns3::PointToPointRemoteChannel::TransmitStart(), ns3::RrFfMacScheduler::UpdateHarqProcessId(), ns3::TdMtFfMacScheduler::UpdateHarqProcessId(), ns3::TtaFfMacScheduler::UpdateHarqProcessId(), ns3::FdMtFfMacScheduler::UpdateHarqProcessId(), ns3::PfFfMacScheduler::UpdateHarqProcessId(), ns3::FdBetFfMacScheduler::UpdateHarqProcessId(), ns3::TdBetFfMacScheduler::UpdateHarqProcessId(), ns3::FdTbfqFfMacScheduler::UpdateHarqProcessId(), ns3::TdTbfqFfMacScheduler::UpdateHarqProcessId(), ns3::PssFfMacScheduler::UpdateHarqProcessId(), ns3::flame::FlameProtocolMac::UpdateOutcomingFrame(), and ns3::dot11s::HwmpProtocolMac::UpdateOutcomingFrame().

#define NS_FATAL_ERROR_NO_MSG ( )
Value:
do \
{ \
std::cerr << "file=" << __FILE__ << ", line=" << \
__LINE__ << std::endl; \
std::terminate (); \
} \
while (false)
void FlushStreams(void)
Flush all currently registered streams.
Definition: fatal-impl.cc:116

fatal error handling

When this macro is hit at runtime, details of filename and line number is printed to stderr, and the program is halted by calling std::terminate(). This will trigger any clean up code registered by std::set_terminate (NS3 default is a stream-flushing code), but may be overridden.

This macro is enabled unconditionally in all builds, including debug and optimized builds.

Definition at line 44 of file fatal-error.h.