A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
tutorial-app.h
Go to the documentation of this file.
1
/*
2
* SPDX-License-Identifier: GPL-2.0-only
3
*/
4
5
#ifndef TUTORIAL_APP_H
6
#define TUTORIAL_APP_H
7
8
#include "ns3/core-module.h"
9
#include "ns3/internet-module.h"
10
#include "ns3/network-module.h"
11
12
namespace
ns3
13
{
14
15
class
Application;
16
17
/**
18
* Tutorial - a simple Application sending packets.
19
*/
20
class
TutorialApp
:
public
Application
21
{
22
public
:
23
TutorialApp
();
24
~TutorialApp
()
override
;
25
26
/**
27
* Register this type.
28
* \return The TypeId.
29
*/
30
static
TypeId
GetTypeId
();
31
32
/**
33
* Setup the socket.
34
* \param socket The socket.
35
* \param address The destination address.
36
* \param packetSize The packet size to transmit.
37
* \param nPackets The number of packets to transmit.
38
* \param dataRate the data rate to use.
39
*/
40
void
Setup
(
Ptr<Socket>
socket,
41
Address
address,
42
uint32_t
packetSize
,
43
uint32_t
nPackets,
44
DataRate
dataRate);
45
46
private
:
47
void
StartApplication
()
override
;
48
void
StopApplication
()
override
;
49
50
/// Schedule a new transmission.
51
void
ScheduleTx
();
52
/// Send a packet.
53
void
SendPacket
();
54
55
Ptr<Socket>
m_socket
;
//!< The transmission socket.
56
Address
m_peer
;
//!< The destination address.
57
uint32_t
m_packetSize
;
//!< The packet size.
58
uint32_t
m_nPackets
;
//!< The number of packets to send.
59
DataRate
m_dataRate
;
//!< The data rate to use.
60
EventId
m_sendEvent
;
//!< Send event.
61
bool
m_running
;
//!< True if the application is running.
62
uint32_t
m_packetsSent
;
//!< The number of packets sent.
63
};
64
65
}
// namespace ns3
66
67
#endif
/* TUTORIAL_APP_H */
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::Application
The base class for all ns3 applications.
Definition
application.h:51
ns3::DataRate
Class for representing data rates.
Definition
data-rate.h:78
ns3::EventId
An identifier for simulation events.
Definition
event-id.h:45
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TutorialApp
Tutorial - a simple Application sending packets.
Definition
tutorial-app.h:21
ns3::TutorialApp::StopApplication
void StopApplication() override
Application specific shutdown code.
Definition
tutorial-app.cc:64
ns3::TutorialApp::ScheduleTx
void ScheduleTx()
Schedule a new transmission.
Definition
tutorial-app.cc:92
ns3::TutorialApp::GetTypeId
static TypeId GetTypeId()
Register this type.
Definition
tutorial-app.cc:30
ns3::TutorialApp::TutorialApp
TutorialApp()
Definition
tutorial-app.cc:11
ns3::TutorialApp::~TutorialApp
~TutorialApp() override
Definition
tutorial-app.cc:23
ns3::TutorialApp::m_sendEvent
EventId m_sendEvent
Send event.
Definition
tutorial-app.h:60
ns3::TutorialApp::m_socket
Ptr< Socket > m_socket
The transmission socket.
Definition
tutorial-app.h:55
ns3::TutorialApp::m_packetsSent
uint32_t m_packetsSent
The number of packets sent.
Definition
tutorial-app.h:62
ns3::TutorialApp::SendPacket
void SendPacket()
Send a packet.
Definition
tutorial-app.cc:80
ns3::TutorialApp::m_peer
Address m_peer
The destination address.
Definition
tutorial-app.h:56
ns3::TutorialApp::m_packetSize
uint32_t m_packetSize
The packet size.
Definition
tutorial-app.h:57
ns3::TutorialApp::Setup
void Setup(Ptr< Socket > socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate)
Setup the socket.
Definition
tutorial-app.cc:40
ns3::TutorialApp::StartApplication
void StartApplication() override
Application specific startup code.
Definition
tutorial-app.cc:54
ns3::TutorialApp::m_dataRate
DataRate m_dataRate
The data rate to use.
Definition
tutorial-app.h:59
ns3::TutorialApp::m_nPackets
uint32_t m_nPackets
The number of packets to send.
Definition
tutorial-app.h:58
ns3::TutorialApp::m_running
bool m_running
True if the application is running.
Definition
tutorial-app.h:61
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
packetSize
static const uint32_t packetSize
Packet size generated at the AP.
Definition
wifi-power-adaptation-distance.cc:96
examples
tutorial
tutorial-app.h
Generated on Fri Nov 8 2024 13:58:58 for ns-3 by
1.11.0