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 #include <stdint.h>
32 #include <string>
33 
34 namespace ns3
35 {
36 
44 class SatPacketTrace : public Object
45 {
46  public:
51 
55  virtual ~SatPacketTrace();
56 
57  TypeId GetInstanceTypeId() const;
58 
63  static TypeId GetTypeId(void);
64 
68  virtual void DoDispose();
69 
82  void AddTraceEntry(Time now,
83  SatEnums::SatPacketEvent_t packetEvent,
84  SatEnums::SatNodeType_t nodeType,
85  uint32_t nodeId,
86  Mac48Address macAddress,
87  SatEnums::SatLogLevel_t logLevel,
88  SatEnums::SatLinkDir_t linkDir,
89  std::string packetInfo);
90 
91  private:
95  void PrintHeader();
96 
100  std::string m_fileName;
101 
105  Ptr<OutputStreamWrapper> m_packetTraceStream;
106 };
107 
108 } // namespace ns3
109 
110 #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.