-
Notifications
You must be signed in to change notification settings - Fork 0
/
apps.h
72 lines (58 loc) · 1.8 KB
/
apps.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef APPS_H
#define APPS_H
#include <fstream>
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
# include <vector>
#include "ns3/tag.h"
#include "ns3/packet.h"
#include "ns3/uinteger.h"
using namespace std;
namespace ns3{
//=========================================================================//
//=========================Begin of TAG definition=========================//
//=========================================================================//
class MyTag : public Tag
{
public:
static TypeId GetTypeId (void);
virtual TypeId GetInstanceTypeId (void) const;
virtual uint32_t GetSerializedSize (void) const;
virtual void Serialize (TagBuffer i) const;
virtual void Deserialize (TagBuffer i);
virtual void Print (std::ostream &os) const;
// these are our accessors to our tag structure
void SetSimpleValue (uint32_t value);
uint32_t GetSimpleValue (void) const;
private:
uint32_t m_simpleValue;
};
class MyApp : public Application
{
public:
MyApp ();
virtual ~MyApp();
//void Setup (Ptr<Socket> socket, Address address, uint32_t packetSize, uint32_t nPackets, DataRate dataRate);
void Setup (Ptr<Socket> socket, Address address, uint32_t packetSize, DataRate dataRate);
void SetTagValue(uint32_t value);
void SetDataRate(DataRate rate);
private:
virtual void StartApplication (void);
virtual void StopApplication (void);
void ScheduleTx (void);
void SendPacket (void);
Ptr<Socket> m_socket;
Address m_peer;
uint32_t m_packetSize;
//uint32_t m_nPackets;
DataRate m_dataRate;
EventId m_sendEvent;
bool m_running;
//uint32_t m_packetsSent;
uint32_t m_tagValue;
};
}
#endif