|
RLRP routing
v.0.1.0
|
A class which handles a reward reception for each sent packet. More...

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... | |
A class which handles a reward reception for each sent packet.
| def RewardHandler.RewardWaitHandler.__init__ | ( | self, | |
| table | |||
| ) |
Constructor.
| self | The object pointer. |
| table | Reference to RouteTable.Table object. |
| 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.
| self | The object pointer. |
| reward_message | Messages.RewardMessage object. |
| 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.
| self | The object pointer. |
| dst_ip | Destination IP of the route for this packet. |
| mac | MAC address of the node where the packet had been sent for getting the reward. |
| 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.