A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
sensornode.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
3
4
/*
5
* Copyright (c) 2020 DLTLT
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License version 2 as
9
* published by the Free Software Foundation;
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*
20
* Corresponding author: Niki Hrovatin <niki.hrovatin@famnit.upr.si>
21
*/
22
23
24
#ifndef SENSORNODE_H
25
#define SENSORNODE_H
26
27
#include "ns3/packet.h"
28
29
#include <sodium.h>
30
#include "ns3/proto-packet.pb.h"
31
#include "ns3/serializationwrapper.h"
32
#include "ns3/wsn_node.h"
33
34
namespace
ns3
{
35
36
37
46
class
SensorNode
:
public
Wsn_node
47
{
48
public
:
53
static
TypeId
GetTypeId
(
void
);
54
60
SensorNode
();
61
67
virtual
~SensorNode
();
68
86
void
ReceivePacket
(Ptr<Socket> socket);
87
98
uint32_t
ProcessOnionHead
(
protomessage::ProtoPacket_OnionHead
*onionHead);
99
110
void
ProcessOnionBody
(
protomessage::ProtoPacket_OnionBody
*onionbody);
111
120
void
Accept
(Ptr<Socket> socket,
const
ns3::Address &from);
121
131
uint32_t
DeserializeIpv4ToInt
(uint8_t *buff);
132
133
private
:
142
virtual
void
StartApplication
(
void
);
143
149
virtual
void
StopApplication
(
void
);
150
158
void
Handshake
(
void
);
159
160
Ipv4Address
m_sinkAddress
;
161
//the reading of the sensor
162
uint32_t
m_sensorValue
= 20;
163
};
164
165
}
// namespace ns3
166
167
#endif
/* SENSORNODE_H */
ns3
Definition:
sensornode-helper.cc:26
ns3::SensorNode::SensorNode
SensorNode()
Default constructor.
Definition:
sensornode.cc:45
ns3::SensorNode::m_sensorValue
uint32_t m_sensorValue
dummy reading of a sensor equipped on the node
Definition:
sensornode.h:162
ns3::SensorNode::ReceivePacket
void ReceivePacket(Ptr< Socket > socket)
Executed when a new onion is received.
Definition:
sensornode.cc:79
ns3::SensorNode::StartApplication
virtual void StartApplication(void)
1.Start the application run ns3::Wsn_node::Configure() 2.Generate new encryption keys 3....
Definition:
sensornode.cc:214
ns3::SensorNode::ProcessOnionHead
uint32_t ProcessOnionHead(protomessage::ProtoPacket_OnionHead *onionHead)
Decrypt the outer layer of the onion head, obtain the information of the next IP address,...
Definition:
sensornode.cc:136
ns3::SensorNode::StopApplication
virtual void StopApplication(void)
Stop the application.
Definition:
sensornode.cc:232
ns3::SensorNode
The application of the sensor node.
Definition:
sensornode.h:46
ns3::SensorNode::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition:
sensornode.cc:32
protomessage::ProtoPacket_OnionBody
Definition:
proto-packet.pb.h:271
protomessage::ProtoPacket_OnionHead
Definition:
proto-packet.pb.h:80
ns3::Wsn_node
The wsn node base class that manages the sending and receiving of packets and basic configuration of ...
Definition:
wsn_node.h:61
ns3::SensorNode::Handshake
void Handshake(void)
Construct a new protobuf object containing the node publickey and send it to the sink node.
Definition:
sensornode.cc:57
ns3::SensorNode::~SensorNode
virtual ~SensorNode()
Default destructor.
Definition:
sensornode.cc:49
ns3::SensorNode::m_sinkAddress
Ipv4Address m_sinkAddress
address of the sink node
Definition:
sensornode.h:160
ns3::SensorNode::Accept
void Accept(Ptr< Socket > socket, const ns3::Address &from)
Accept new TCP connections.
Definition:
sensornode.cc:207
ns3::SensorNode::ProcessOnionBody
void ProcessOnionBody(protomessage::ProtoPacket_OnionBody *onionbody)
If the onion body contains the aggregated value, then aggregate the sensor (dummy) value to the value...
Definition:
sensornode.cc:178
ns3::SensorNode::DeserializeIpv4ToInt
uint32_t DeserializeIpv4ToInt(uint8_t *buff)
Convert an IPV4 address given as a buffer.
Definition:
sensornode.cc:192
src
onion_routing_wsn
model
sensornode.h
Generated on Mon Feb 7 2022 13:31:58 for ns-3 by
1.8.17