Skip to content

Exact Process of Forwarding

maniacchallenge edited this page Jul 29, 2013 · 5 revisions

When you send a packet to another host in a mesh network, it probably takes a few hops. So all you do yourself is give the packet to a one-hop neighbor in the right direction, and he will forward it further, until it reaches its destination.

The concept of the ManiacChallenge now is, that every forwarding by one hop is handled as an auction. Let's say you are host H_1 and want to send a packet to Host H_x. Your one hop neighbors, which are in wifi range to you, are Hosts H_n1, H_n2 and H_n3. You now send a so called 'Advert' to them (as a broadcast), which says something like "Hey guys, I have this packet I want to get to H_x, how much virtual money do you want from me to forward it for me?". If your one-hop neighbors are interested, they will answer with a 'Bid', in which they say how much it will cost you, if they forward it. After collecting all the bids, you choose a winner and bulk out who he is, so that everyone knows who won. Then you give your packet to him (and only to him, of course), so he can do his job. He will now start this little game from the beginning with his one-hop neighbors.

However, there are some things every participant has to care about: If you wait too long before you send your bid, the auctioneer won't care about it. This time is called the auction timeout, which is predefined, because everybody has to know the rules of the game they're in.

Also, you're not allowed to route packets in a circle. If you have ever participated in an auction for a specific packet, you must not do it again. But don't worry, the API takes care of that.

Besides, it's pretty helpful if the packet won't be forwarded for ever and ever, but will arrive at some point in the future or dropped. To ensure that, every packet has a hop count (which is just like the TTL of an IP-packet) that will be decremented by one for every forwarding, and the one who initiated the first auction will tell you how many hops a packet can take, before it will be dropped.

If the packet doesn't make it to its destination within this deadline, everyone who has ever touched it (except that first guy) will be fined. The fine for the winner of an auction is set by the auctioneer. If you have an auction, you will most likely start a new one and can set the fine for the next winner to whatever you like, as long as it's equal or lower to your fine.

To make sure everyone knows what they're talking about, every packet has a so called 'Transaction ID', which is a unique identifier for every packet and will stay the same during every auction.

So, summarized, we have four types of packets:

  • Adverts, which are broadcasted to your one-hop neighbors

  • Bids, which are also sent to the broadcast address, and contain the amount of computer-money you want for forwarding packet

  • BidWins, which are sent to the broadcast address, too, and announce the winner of the auction to everyone

  • Data, which contains the actual packet to be forwarded

Clone this wiki locally