satellite-packet-trace.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 Magister Solutions Ltd.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Jani Puttonen <jani.puttonen@magister.fi>
19  */
20 
21 #ifndef SATELLITE_PACKET_TRACE_H_
22 #define SATELLITE_PACKET_TRACE_H_
23 
24 #include "satellite-enums.h"
25 
26 #include <ns3/mac48-address.h>
27 #include <ns3/nstime.h>
28 #include <ns3/object.h>
29 #include <ns3/output-stream-wrapper.h>
30 
31 namespace ns3
32 {
33 
41 class SatPacketTrace : public Object
42 {
43  public:
48 
52  virtual ~SatPacketTrace();
53 
54  TypeId GetInstanceTypeId() const;
55 
60  static TypeId GetTypeId(void);
61 
65  virtual void DoDispose();
66 
79  void AddTraceEntry(Time now,
80  SatEnums::SatPacketEvent_t packetEvent,
81  SatEnums::SatNodeType_t nodeType,
82  uint32_t nodeId,
83  Mac48Address macAddress,
84  SatEnums::SatLogLevel_t logLevel,
85  SatEnums::SatLinkDir_t linkDir,
86  std::string packetInfo);
87 
88  private:
92  void PrintHeader();
93 
97  std::string m_fileName;
98 
102  Ptr<OutputStreamWrapper> m_packetTraceStream;
103 };
104 
105 } // namespace ns3
106 
107 #endif /* SATELLITE_PACKET_TRACE_H_ */
SatLinkDir_t
Link direction used for packet tracing.
SatNodeType_t
Node type used for packet tracing.
SatPacketEvent_t
Packet event used for packet tracing.
SatLogLevel_t
Log level used for packet tracing.
The SatPacketTrace implements a packet trace functionality.
virtual ~SatPacketTrace()
Destructor.
Ptr< OutputStreamWrapper > m_packetTraceStream
Stream wrapper used for packet traces.
TypeId GetInstanceTypeId() const
virtual void DoDispose()
Dispose of this class instance.
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.