satellite-phy-rx-carrier-packet-probe.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Bucknell University
4  * Copyright (c) 2014 Magister Solutions
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors of original work (application-packet-probe.h) which this work
20  * derives from:
21  * - L. Felipe Perrone (perrone@bucknell.edu)
22  * - Tiago G. Rodrigues (tgr002@bucknell.edu)
23  * - Mitch Watrous (watrous@u.washington.edu)
24  *
25  * Modified for the signature of SatPhyRxCarrier trace sources by:
26  * - Budiarto Herman (budiarto.herman@magister.fi)
27  */
28 
29 #ifndef SATELLITE_PHY_RX_CARRIER_PACKET_PROBE_H
30 #define SATELLITE_PHY_RX_CARRIER_PACKET_PROBE_H
31 
32 #include <ns3/address.h>
33 #include <ns3/nstime.h>
34 #include <ns3/probe.h>
35 #include <ns3/traced-callback.h>
36 
37 #include <string>
38 
39 namespace ns3
40 {
41 
53 class SatPhyRxCarrierPacketProbe : public Probe
54 {
55  public:
60  static TypeId GetTypeId();
61 
66 
71 
79  void SetValue(uint32_t nPackets, const Address& address, bool statusFlag);
80 
89  static void SetValueByPath(std::string path,
90  uint32_t nPackets,
91  const Address& address,
92  bool statusFlag);
93 
101  virtual bool ConnectByObject(std::string traceSource, Ptr<Object> obj);
102 
111  virtual void ConnectByPath(std::string path);
112 
120  typedef void (*RxStatusCallback)(uint32_t nPackets, const Address& from, bool status);
121 
122  private:
132  void TraceSink(uint32_t nPackets, const Address& address, bool statusFlag);
133 
135  TracedCallback<uint32_t, const Address&, bool> m_output;
137  TracedCallback<uint32_t, uint32_t> m_outputUinteger;
139  TracedCallback<bool, bool> m_outputBool;
140 
142  uint32_t m_nPackets;
144  Address m_address;
147 };
148 
149 } // namespace ns3
150 
151 #endif // SATELLITE_PHY_RX_CARRIER_PACKET_PROBE_H
Probe to translate from a TraceSource to two more easily parsed TraceSources.
bool m_statusFlag
The traced packet burst status flag.
uint32_t m_nPackets
The traced number of packets in the packet burst.
TracedCallback< uint32_t, const Address &, bool > m_output
Output trace, the number of packets, source address, and status flag.
virtual void ConnectByPath(std::string path)
connect to a trace source provided by a config path
virtual bool ConnectByObject(std::string traceSource, Ptr< Object > obj)
connect to a trace source attribute provided by a given object
void SetValue(uint32_t nPackets, const Address &address, bool statusFlag)
Set a probe value.
void(* RxStatusCallback)(uint32_t nPackets, const Address &from, bool status)
Common callback signature for trace sources related to packets reception by PHY and its status.
TracedCallback< uint32_t, uint32_t > m_outputUinteger
Output trace, previous and current number of packets.
virtual ~SatPhyRxCarrierPacketProbe()
Destructor for SatPhyRxCarrierPacketProbe.
static void SetValueByPath(std::string path, uint32_t nPackets, const Address &address, bool statusFlag)
Set a probe value by its name in the Config system.
Address m_address
The socket address for the traced packet burst.
void TraceSink(uint32_t nPackets, const Address &address, bool statusFlag)
Method to connect to an underlying ns3::TraceSource with arguments of type double and const Address&.
TracedCallback< bool, bool > m_outputBool
Output trace, previous and current status flag.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.