A Discrete-Event Network Simulator
API
onionvalidator.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 ONIONVALIDATOR_H
25 #define ONIONVALIDATOR_H
26 
27 
28 #include <iostream>
29 #include <fstream>
30 #include <string>
31 #include <fstream>
32 #include "ns3/core-module.h"
33 #include <vector>
34 #include "ns3/output-stream-wrapper.h"
35 #include "ns3/internet-module.h"
36 #include <time.h>
37 
38 namespace ns3 {
39 
55 class OnionValidator : public Object
56 {
57 
58 public:
64  OnionValidator ();
65 
71  ~OnionValidator ();
72 
77  static TypeId GetTypeId (void);
78 
87  void StartOnion (int seq_n);
88 
95  bool OnionStatus (void);
96 
107  bool CheckOnionReceived (int hop);
114  int OnionHopCount (void);
115 
122  int GetOnionSeq (void);
123 
129  void OnionReceived (void);
130 
131  int m_onionSeq = 0;
132 
134  0;
135 };
136 
137 } // namespace ns3
138 
139 #endif /* ONIONVALIDATOR_H */
ns3
Definition: sensornode-helper.cc:26
ns3::OnionValidator
Class shared between wsn nodes used to track how the onion is transiting in the WSN The class uses tw...
Definition: onionvalidator.h:55
ns3::OnionValidator::GetOnionSeq
int GetOnionSeq(void)
Return the current onion sequence number (the onionId)
Definition: onionvalidator.cc:99
ns3::OnionValidator::m_onionSeq
int m_onionSeq
the onionId of the onion currently transiting the network
Definition: onionvalidator.h:131
ns3::OnionValidator::OnionReceived
void OnionReceived(void)
The onion was correctly received, increment the hop count.
Definition: onionvalidator.cc:106
ns3::OnionValidator::m_hopCount
int m_hopCount
a sequence number incremented each time a node correctly receives an onion message
Definition: onionvalidator.h:133
ns3::OnionValidator::CheckOnionReceived
bool CheckOnionReceived(int hop)
Called by the sensor nodes when the m_onionTimeout elapses IF m_hopCount is equal to hop then the oni...
Definition: onionvalidator.cc:78
ns3::OnionValidator::~OnionValidator
~OnionValidator()
Default destructor.
Definition: onionvalidator.cc:45
ns3::OnionValidator::OnionValidator
OnionValidator()
Default constructor.
Definition: onionvalidator.cc:41
ns3::OnionValidator::GetTypeId
static TypeId GetTypeId(void)
Definition: onionvalidator.cc:34
ns3::OnionValidator::OnionStatus
bool OnionStatus(void)
Called by the sink node to check if the onion is still running or is aborted.
Definition: onionvalidator.cc:59
ns3::OnionValidator::OnionHopCount
int OnionHopCount(void)
Return the current hop sequence number.
Definition: onionvalidator.cc:92
ns3::OnionValidator::StartOnion
void StartOnion(int seq_n)
Called by the sink node, set up the m_onionSeq to the onionId value for keeping track of the onion.
Definition: onionvalidator.cc:52