RLRP routing  v.0.1.0
RewardHandler.RewardWaitHandler Class Reference

A class which handles a reward reception for each sent packet. More...

Collaboration diagram for RewardHandler.RewardWaitHandler:
Collaboration graph

Public Member Functions

def __init__ (self, table)
 Constructor. More...
 
def wait_for_reward (self, dst_ip, mac)
 Start a waiting thread until the Reward message is received. More...
 
def set_reward (self, reward_message)
 Set a reward value to a specified entry, based on the received object of Messages.RewardMessage.msg_hash. More...
 

Public Attributes

 table
 Reference to RouteTable.Table object. More...
 
 reward_wait_list
 Define a structure for handling reward wait threads for given dst_ips. More...
 

Detailed Description

A class which handles a reward reception for each sent packet.

Constructor & Destructor Documentation

def RewardHandler.RewardWaitHandler.__init__ (   self,
  table 
)

Constructor.

Parameters
selfThe object pointer.
tableReference to RouteTable.Table object.
Returns
None

Member Function Documentation

def RewardHandler.RewardWaitHandler.set_reward (   self,
  reward_message 
)

Set a reward value to a specified entry, based on the received object of Messages.RewardMessage.msg_hash.

Parameters
selfThe object pointer.
reward_messageMessages.RewardMessage object.
Returns
None
def RewardHandler.RewardWaitHandler.wait_for_reward (   self,
  dst_ip,
  mac 
)

Start a waiting thread until the Reward message is received.

Check if the waiting process for such dst_ip and next_hop_mac has already been initiated or not. If yes - do nothing. Else - start the reward waiting thread.

Parameters
selfThe object pointer.
dst_ipDestination IP of the route for this packet.
macMAC address of the node where the packet had been sent for getting the reward.
Returns
None

Member Data Documentation

RewardHandler.RewardWaitHandler.reward_wait_list

Define a structure for handling reward wait threads for given dst_ips.

Format: {hash(dst_ip + next_hop_mac): thread_object}. Hash is 32-bit integer, generated from md5 hash. A reward value is being forwarded to the thread via a queue_object.

RewardHandler.RewardWaitHandler.table

Reference to RouteTable.Table object.


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