A Discrete-Event Network Simulator
API
ns3::OnionValidator Class Reference

Class shared between wsn nodes used to track how the onion is transiting in the WSN The class uses two counters m_onionSeq and m_hopCount to identify when an onion neeeds to be aborted. More...

#include "onionvalidator.h"

+ Inheritance diagram for ns3::OnionValidator:
+ Collaboration diagram for ns3::OnionValidator:

Public Member Functions

 OnionValidator ()
 Default constructor. More...
 
 ~OnionValidator ()
 Default destructor. More...
 
bool CheckOnionReceived (int hop)
 Called by the sensor nodes when the m_onionTimeout elapses IF m_hopCount is equal to hop then the onion was not received by the next hop Therefore abort the onion. More...
 
int GetOnionSeq (void)
 Return the current onion sequence number (the onionId) More...
 
int OnionHopCount (void)
 Return the current hop sequence number. More...
 
void OnionReceived (void)
 The onion was correctly received, increment the hop count. More...
 
bool OnionStatus (void)
 Called by the sink node to check if the onion is still running or is aborted. More...
 
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. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 

Public Attributes

int m_hopCount
 a sequence number incremented each time a node correctly receives an onion message More...
 
int m_onionSeq = 0
 the onionId of the onion currently transiting the network More...
 

Detailed Description

Class shared between wsn nodes used to track how the onion is transiting in the WSN The class uses two counters m_onionSeq and m_hopCount to identify when an onion neeeds to be aborted.

Definition at line 55 of file onionvalidator.h.

Constructor & Destructor Documentation

◆ OnionValidator()

ns3::OnionValidator::OnionValidator ( )

Default constructor.

Definition at line 41 of file onionvalidator.cc.

◆ ~OnionValidator()

ns3::OnionValidator::~OnionValidator ( )

Default destructor.

Definition at line 45 of file onionvalidator.cc.

Member Function Documentation

◆ CheckOnionReceived()

bool ns3::OnionValidator::CheckOnionReceived ( int  hop)

Called by the sensor nodes when the m_onionTimeout elapses IF m_hopCount is equal to hop then the onion was not received by the next hop Therefore abort the onion.

Parameters
[in]hopthe m_hopCount number set when the onion was forwarded to the next node
Returns
TRUE if the onion is running, FALSE if the onion was aborted

Definition at line 78 of file onionvalidator.cc.

References m_hopCount, and m_onionSeq.

◆ GetOnionSeq()

int ns3::OnionValidator::GetOnionSeq ( void  )

Return the current onion sequence number (the onionId)

Returns
return the onion sequence number

Definition at line 99 of file onionvalidator.cc.

References m_onionSeq.

◆ GetTypeId()

TypeId ns3::OnionValidator::GetTypeId ( void  )
static
Returns
The object TypeId.

Definition at line 34 of file onionvalidator.cc.

◆ OnionHopCount()

int ns3::OnionValidator::OnionHopCount ( void  )

Return the current hop sequence number.

Returns
return the hop count

Definition at line 92 of file onionvalidator.cc.

References m_hopCount.

◆ OnionReceived()

void ns3::OnionValidator::OnionReceived ( void  )

The onion was correctly received, increment the hop count.

Definition at line 106 of file onionvalidator.cc.

References m_hopCount.

◆ OnionStatus()

bool ns3::OnionValidator::OnionStatus ( void  )

Called by the sink node to check if the onion is still running or is aborted.

Returns
TRUE if the onion is running, FALSE if the onion was aborted

Definition at line 59 of file onionvalidator.cc.

References m_onionSeq.

◆ StartOnion()

void ns3::OnionValidator::StartOnion ( int  seq_n)

Called by the sink node, set up the m_onionSeq to the onionId value for keeping track of the onion.

Parameters
[in]seq_nthe onion ID

Definition at line 52 of file onionvalidator.cc.

References m_onionSeq.

Member Data Documentation

◆ m_hopCount

int ns3::OnionValidator::m_hopCount
Initial value:
=
0

a sequence number incremented each time a node correctly receives an onion message

Definition at line 133 of file onionvalidator.h.

Referenced by CheckOnionReceived(), OnionHopCount(), and OnionReceived().

◆ m_onionSeq

int ns3::OnionValidator::m_onionSeq = 0

the onionId of the onion currently transiting the network

Definition at line 131 of file onionvalidator.h.

Referenced by CheckOnionReceived(), GetOnionSeq(), OnionStatus(), and StartOnion().


The documentation for this class was generated from the following files: