23 #include "../utils/satellite-env-variables.h"
26 #include <ns3/mac48-address.h>
27 #include <ns3/object.h>
28 #include <ns3/output-stream-wrapper.h>
29 #include <ns3/singleton.h>
30 #include <ns3/string.h>
31 #include <ns3/trace-helper.h>
37 NS_LOG_COMPONENT_DEFINE(
"SatPacketTrace");
42 NS_OBJECT_ENSURE_REGISTERED(SatPacketTrace);
46 ObjectBase::ConstructSelf(AttributeConstructionList());
48 AsciiTraceHelper asciiTraceHelper;
50 std::stringstream outputPath;
51 outputPath << Singleton<SatEnvVariables>::Get()->GetOutputPath() <<
"/" <<
m_fileName <<
".log";
60 NS_LOG_FUNCTION(
this);
66 NS_LOG_FUNCTION(
this);
73 static TypeId tid = TypeId(
"ns3::SatPacketTrace")
75 .AddAttribute(
"FileName",
76 "File name for the packet trace output",
77 StringValue(
"PacketTrace"),
86 NS_LOG_FUNCTION(
this);
93 NS_LOG_FUNCTION(
this);
105 <<
"Packet info (List of: Packet id, source MAC address, destination MAC address)"
115 Mac48Address macAddress,
118 std::string packetInfo)
120 NS_LOG_FUNCTION(
this << now.GetSeconds());
133 std::ostringstream oss;
SatLinkDir_t
Link direction used for packet tracing.
static std::string GetNodeTypeName(SatNodeType_t nodeType)
SatNodeType_t
Node type used for packet tracing.
static std::string GetLinkDirName(SatLinkDir_t linkDir)
SatPacketEvent_t
Packet event used for packet tracing.
static std::string GetPacketEventName(SatPacketEvent_t packetEvent)
static std::string GetLogLevelName(SatLogLevel_t logLevel)
SatLogLevel_t
Log level used for packet tracing.
virtual ~SatPacketTrace()
Destructor.
Ptr< OutputStreamWrapper > m_packetTraceStream
Stream wrapper used for packet traces.
TypeId GetInstanceTypeId() const
virtual void DoDispose()
Dispose of this class instance.
SatPacketTrace()
Constructor.
std::string m_fileName
File name of the packet trace log.
void PrintHeader()
Print header to the packet trace log.
void AddTraceEntry(Time now, SatEnums::SatPacketEvent_t packetEvent, SatEnums::SatNodeType_t nodeType, uint32_t nodeId, Mac48Address macAddress, SatEnums::SatLogLevel_t logLevel, SatEnums::SatLinkDir_t linkDir, std::string packetInfo)
Add a packet trace entry to the log.
static TypeId GetTypeId(void)
Get the type ID.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.