The wsn node base class that manages the sending and receiving of packets and basic configuration of nodes. More...
#include "wsn_node.h"
Inheritance diagram for ns3::Wsn_node:
Collaboration diagram for ns3::Wsn_node:Public Member Functions | |
| Wsn_node () | |
| Default constructor. More... | |
| void | ActivateNode () |
| The method re-activates a node that was disabled using the DisableNode() method. More... | |
| void | CheckSentOnion (int count) |
| The method checks if the onion was received by the next receiving node If the onion was not received then abort the current onion and schedule the sending of another onion with equal parametrs as the aborted onion. More... | |
| void | Configure (void) |
| 1. More... | |
| void | DisableNode () |
| The method disables the node. More... | |
| uint32_t | getNodeDelay (Ipv4Address node_address) |
| compute when the node should start the handshake process from the node ip address Used to not generate a network congestion if all nodes will strat the handshake at the same time More... | |
| void | NodeDegree (double coord_x, double coord_y) |
| Retrieve the degreee this node from the OLSR routing protocol. More... | |
| void | NotifyRx (Ptr< const Packet > packet) |
Call to signal the receipt of a Packet at the application layer. More... | |
| void | NotifyTx (Ptr< const Packet > packet) |
Call to signal the transmission of a Packet at the application layer. More... | |
| void | OnionReceived (void) |
| Signal to the ns3::OnionValidator that the onion was corrctly received. More... | |
| Ptr< Packet > | RecvSeg (Ptr< Socket > socket, Ptr< Packet > p, Address from) |
| method for receiving packets able to merge segment fragments if a packet was split into multiple segments due to being larger than the MSS Use the packet tag, to merge packet fragments into a single packet. More... | |
| Ptr< Packet > | RecvSegment (Ptr< Socket > socket) |
| method for receiving a segment calls ns3::Wsn_node::RecvSeg() More... | |
| Ptr< Packet > | RecvSegment (Ptr< Socket > socket, Address &from) |
| method for receiving a segment calls ns3::Wsn_node::RecvSeg() More... | |
| void | SendSegment (InetSocketAddress remote, Ptr< Packet > packet, bool b_onion) |
| Send a packet through a TCP connection to the remote address. More... | |
Static Public Member Functions | |
| static TypeId | GetTypeId (void) |
| Register this type. More... | |
Protected Attributes | |
| uint16_t | f_mss |
| maximum segment size More... | |
| Ptr< Packet > | f_pendingPacket |
| pointer to the packet where received segment fragments are stored More... | |
| Ipv4Address | f_receivingAddress = Ipv4Address::GetAny () |
| the receiving address More... | |
| int | f_segmentSize |
| the size of the whole packet More... | |
| Ipv4Address | m_address |
| ns3::Ipv4Address of this node More... | |
| TracedCallback< Ptr< const Packet > > | m_appRx |
| traced callback for packet receipt More... | |
| TracedCallback< Ptr< const Packet > > | m_appTx |
| traced callback for packet transmission More... | |
| uint16_t | m_delay |
| delay after which the handshake process will start More... | |
| OnionManager | m_onionManager |
| The ns3::OnionManager object. More... | |
| uint16_t | m_onionTimeout |
| timer in seconds, if elepsed and the onion was not recieved by the next receiver, then delete the onion More... | |
| Ptr< OnionValidator > | m_onionValidator |
| Pointer to the ns3::OnionValidator. More... | |
| Ptr< OutputManager > | m_outputManager |
| Pointer to the ns3::OutputManager. More... | |
| uint16_t | m_port |
| port of the application More... | |
| Ptr< Socket > | m_socket |
| listening socket More... | |
| int | o_hopCount = 0 |
| track how the onion is is transiting in the network More... | |
| int | o_sequenceNum = 0 |
| sequence number of the onion, should be same as onion_id More... | |
Private Member Functions | |
| virtual void | StartApplication (void) |
| Start the application. More... | |
| virtual void | StopApplication (void) |
| Stop the application. More... | |
The wsn node base class that manages the sending and receiving of packets and basic configuration of nodes.
Definition at line 61 of file wsn_node.h.
| ns3::Wsn_node::Wsn_node | ( | ) |
Default constructor.
Definition at line 87 of file wsn_node.cc.
| void ns3::Wsn_node::ActivateNode | ( | ) |
The method re-activates a node that was disabled using the DisableNode() method.
Definition at line 146 of file wsn_node.cc.
| void ns3::Wsn_node::CheckSentOnion | ( | int | count | ) |
The method checks if the onion was received by the next receiving node If the onion was not received then abort the current onion and schedule the sending of another onion with equal parametrs as the aborted onion.
Checking onion.
Definition at line 321 of file wsn_node.cc.
References m_onionValidator, and m_outputManager.
Referenced by SendSegment().
Here is the caller graph for this function:| void ns3::Wsn_node::Configure | ( | void | ) |
1.
configure basic attributes of nodes
Definition at line 102 of file wsn_node.cc.
References m_address, m_outputManager, m_port, m_socket, NodeDegree(), and ns3::OLSR.
Referenced by ns3::Sink::StartApplication(), and ns3::SensorNode::StartApplication().
Here is the call graph for this function:
Here is the caller graph for this function:| void ns3::Wsn_node::DisableNode | ( | ) |
The method disables the node.
The node is unreachable for other nodes and is not collaborating in routing.
Definition at line 135 of file wsn_node.cc.
| uint32_t ns3::Wsn_node::getNodeDelay | ( | Ipv4Address | node_address | ) |
compute when the node should start the handshake process from the node ip address Used to not generate a network congestion if all nodes will strat the handshake at the same time
| [in] | node_address | the ipv4 address |
Definition at line 198 of file wsn_node.cc.
References m_delay.
Referenced by ns3::SensorNode::StartApplication().
Here is the caller graph for this function:
|
static |
Register this type.
Definition at line 36 of file wsn_node.cc.
References f_mss, m_appRx, m_appTx, m_delay, m_onionTimeout, m_onionValidator, m_outputManager, and m_port.
| void ns3::Wsn_node::NodeDegree | ( | double | coord_x, |
| double | coord_y | ||
| ) |
Retrieve the degreee this node from the OLSR routing protocol.
Works only if using the OLSR protocol. We refer to the degreee of the current node as the number of nodes that are in the one-hop neighbourhood of the current node with respect to the multi-hop communication.
| [in] | coord_x | x coordinate of the current node |
| [out] | coord_y | y coordinate of the current node |
Get one hop neighbours:
Definition at line 163 of file wsn_node.cc.
References m_address, and m_outputManager.
Referenced by Configure().
Here is the caller graph for this function:| void ns3::Wsn_node::NotifyRx | ( | Ptr< const Packet > | packet | ) |
Call to signal the receipt of a Packet at the application layer.
Definition at line 82 of file wsn_node.cc.
References m_appRx.
Referenced by ns3::SensorNode::ReceivePacket(), and ns3::Sink::ReceivePacket().
Here is the caller graph for this function:| void ns3::Wsn_node::NotifyTx | ( | Ptr< const Packet > | packet | ) |
Call to signal the transmission of a Packet at the application layer.
Definition at line 76 of file wsn_node.cc.
References m_appTx.
Referenced by ns3::SensorNode::ReceivePacket(), and ns3::Sink::SendOnion().
Here is the caller graph for this function:| void ns3::Wsn_node::OnionReceived | ( | void | ) |
Signal to the ns3::OnionValidator that the onion was corrctly received.
Definition at line 331 of file wsn_node.cc.
References m_onionValidator.
Referenced by ns3::SensorNode::ReceivePacket(), and ns3::Sink::ReceivePacket().
Here is the caller graph for this function:| Ptr< Packet > ns3::Wsn_node::RecvSeg | ( | Ptr< Socket > | socket, |
| Ptr< Packet > | p, | ||
| Address | from | ||
| ) |
method for receiving packets able to merge segment fragments if a packet was split into multiple segments due to being larger than the MSS Use the packet tag, to merge packet fragments into a single packet.
| [in] | socket | the receiving socket |
| [in] | packet | pointer to the receiving packet |
| [in,out] | from | extract the sender IP from the receiving socket |
Definition at line 279 of file wsn_node.cc.
References f_pendingPacket, f_receivingAddress, f_segmentSize, and ns3::SegmentNum::GetSegNum().
Referenced by RecvSegment().
Here is the call graph for this function:
Here is the caller graph for this function:| Ptr< Packet > ns3::Wsn_node::RecvSegment | ( | Ptr< Socket > | socket | ) |
method for receiving a segment calls ns3::Wsn_node::RecvSeg()
| [in] | socket | the receiving socket |
Definition at line 249 of file wsn_node.cc.
References RecvSeg().
Referenced by ns3::SensorNode::ReceivePacket(), and ns3::Sink::ReceivePacket().
Here is the call graph for this function:
Here is the caller graph for this function:| Ptr< Packet > ns3::Wsn_node::RecvSegment | ( | Ptr< Socket > | socket, |
| Address & | from | ||
| ) |
method for receiving a segment calls ns3::Wsn_node::RecvSeg()
| [in] | socket | the receiving socket |
| [in,out] | from | extract the sender IP from the receiving socket |
Definition at line 262 of file wsn_node.cc.
References RecvSeg().
Here is the call graph for this function:| void ns3::Wsn_node::SendSegment | ( | InetSocketAddress | remote, |
| Ptr< Packet > | packet, | ||
| bool | b_onion | ||
| ) |
Send a packet through a TCP connection to the remote address.
Set b_onion to true to send an onion message. If b_onion is true, the method sets a callback after m_onionTimeout seconds The callback triggers the function ns3::Wsn_node::CheckSentOnion(). If the packe size is larger than the MSS. Then add a tag to the packet, which specifies the size of the whole packet. The tag is used by ns3::Wsn_node::RecvSeg() to reconstruct a packet that was split into multiple segments.
| [in] | remote | the receiving address |
| [in] | packet | the packet to send |
| [in] | b_onion | boolean value, set to true if sending an onion message. Adds the packet TAG to the packet |
Definition at line 217 of file wsn_node.cc.
References CheckSentOnion(), f_mss, m_onionTimeout, m_onionValidator, and o_hopCount.
Referenced by ns3::SensorNode::Handshake(), ns3::SensorNode::ReceivePacket(), and ns3::Sink::SendOnion().
Here is the call graph for this function:
Here is the caller graph for this function:
|
privatevirtual |
Start the application.
Reimplemented in ns3::SensorNode, and ns3::Sink.
Definition at line 92 of file wsn_node.cc.
|
privatevirtual |
Stop the application.
Reimplemented in ns3::SensorNode, and ns3::Sink.
Definition at line 97 of file wsn_node.cc.
|
protected |
maximum segment size
Definition at line 233 of file wsn_node.h.
Referenced by GetTypeId(), and SendSegment().
|
protected |
pointer to the packet where received segment fragments are stored
Definition at line 236 of file wsn_node.h.
Referenced by RecvSeg().
|
protected |
|
protected |
|
protected |
ns3::Ipv4Address of this node
Definition at line 227 of file wsn_node.h.
Referenced by Configure(), NodeDegree(), ns3::Sink::PrepareOnion(), ns3::SensorNode::ReceivePacket(), ns3::Sink::ReceivePacket(), ns3::Sink::SendOnion(), and ns3::SensorNode::StartApplication().
|
protected |
traced callback for packet receipt
Definition at line 248 of file wsn_node.h.
Referenced by GetTypeId(), and NotifyRx().
|
protected |
traced callback for packet transmission
Definition at line 247 of file wsn_node.h.
Referenced by GetTypeId(), and NotifyTx().
|
protected |
delay after which the handshake process will start
Definition at line 229 of file wsn_node.h.
Referenced by getNodeDelay(), GetTypeId(), and ns3::Sink::StartApplication().
|
protected |
The ns3::OnionManager object.
Definition at line 230 of file wsn_node.h.
Referenced by ns3::SensorNode::Handshake(), ns3::Sink::PrepareOnion(), ns3::SensorNode::ProcessOnionHead(), ns3::Sink::SendOnion(), ns3::Sink::StartApplication(), and ns3::SensorNode::StartApplication().
|
protected |
timer in seconds, if elepsed and the onion was not recieved by the next receiver, then delete the onion
Definition at line 244 of file wsn_node.h.
Referenced by GetTypeId(), and SendSegment().
|
protected |
Pointer to the ns3::OnionValidator.
Definition at line 226 of file wsn_node.h.
Referenced by ns3::Sink::CheckOnion(), CheckSentOnion(), GetTypeId(), OnionReceived(), ns3::SensorNode::ReceivePacket(), ns3::Sink::SendOnion(), and SendSegment().
|
protected |
Pointer to the ns3::OutputManager.
Definition at line 225 of file wsn_node.h.
Referenced by CheckSentOnion(), Configure(), GetTypeId(), NodeDegree(), ns3::SensorNode::ReceivePacket(), ns3::Sink::RecvHandshake(), ns3::Sink::RecvOnion(), ns3::Sink::SendOnion(), and ns3::Sink::SinkTasks().
|
protected |
port of the application
Definition at line 224 of file wsn_node.h.
Referenced by Configure(), GetTypeId(), ns3::SensorNode::Handshake(), ns3::SensorNode::ReceivePacket(), and ns3::Sink::SendOnion().
|
protected |
listening socket
Definition at line 228 of file wsn_node.h.
Referenced by Configure(), ns3::Sink::StartApplication(), ns3::SensorNode::StartApplication(), ns3::Sink::StopApplication(), ns3::SensorNode::StopApplication(), ns3::SensorNode::~SensorNode(), and ns3::Sink::~Sink().
|
protected |
track how the onion is is transiting in the network
Definition at line 240 of file wsn_node.h.
Referenced by SendSegment().
|
protected |
sequence number of the onion, should be same as onion_id
Definition at line 241 of file wsn_node.h.
Referenced by ns3::SensorNode::ReceivePacket(), and ns3::Sink::ReceivePacket().