Loading...
Searching...
No Matches
satellite-on-off-application.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2014 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: Sami Rantanen <sami.rantanen@magister.fi>
19 */
20
22
23#include "ns3/boolean.h"
24#include "ns3/log.h"
25#include "ns3/packet.h"
26#include "ns3/simulator.h"
27#include "ns3/traced-callback.h"
28#include "ns3/traffic-time-tag.h"
29
30#include <stdint.h>
31
32NS_LOG_COMPONENT_DEFINE("SatOnOffApplication");
33
34namespace ns3
35{
36
37NS_OBJECT_ENSURE_REGISTERED(SatOnOffApplication);
38
39TypeId
41{
42 static TypeId tid =
43 TypeId("ns3::SatOnOffApplication")
44 .SetParent<OnOffApplication>()
45 .AddConstructor<SatOnOffApplication>()
46 .AddAttribute("EnableStatisticsTags",
47 "If true, some tags will be added to each transmitted packet to assist "
48 "with statistics computation",
49 BooleanValue(false),
52 MakeBooleanChecker());
53 return tid;
54}
55
62
64{
65 NS_LOG_FUNCTION(this);
66}
67
68void
70{
71 NS_LOG_FUNCTION(this << enable);
73
75 {
76 /*
77 * Ensure that we don't connect to the same trace source two times.
78 * Otherwise, the same tag type will be added twice, resulting in a
79 * runtime error.
80 */
82 {
83 TraceConnectWithoutContext("Tx",
84 MakeCallback(&SatOnOffApplication::SendPacketTrace, this));
86 }
87 }
88 else
89 {
90 TraceDisconnectWithoutContext("Tx",
91 MakeCallback(&SatOnOffApplication::SendPacketTrace, this));
93 }
94}
95
96bool
101
102void
104{
105 // Add a TrafficTimeTag tag for packet delay computation at the receiver end.
106 packet->AddPacketTag(TrafficTimeTag(Simulator::Now()));
107}
108
109} // Namespace ns3
This class implements Satellite specific OnOff application.
void SendPacketTrace(Ptr< const Packet > packet)
Trace callback for on-off application Tx.
void EnableStatisticTags(bool enableStatus)
Enable or disable statistic tags.
bool m_isStatisticsTagsEnabled
EnableStatisticsTags attribute.
SatOnOffApplication()
Constructor for Satellite specific on-off application.
bool IsStatisticTagsEnabled() const
Get enable status of statistic tags.
virtual ~SatOnOffApplication()
Destructor Satellite specific on-off application.
SatArqSequenceNumber is handling the sequence numbers for the ARQ process.