Research Article
Energy-Efficient Adaptive Geosource Multicast Routing for Wireless Sensor Networks
Algorithm 5
Packet forwarding at each node.
| Input: serialized path, node | | (1) if FirstBit(path0) == 1 then | | (2) // the first byte in path is a delimiter | | (3) if ID(node) ∈ {IDs pointed by the delimiter} then | | (4) pos1 = indexInPath(node) + 1 | | (5) pos2 = indexInPath(next node pointed by delimiter after me) − 1 | | (6) path = {pathpos1, …, pathpos2 | | (7) Forward(path) | | (8) end if | | (9) else | | (10) if FirstTwoBits(path0) == 01 then | | (11) // the first byte in path is x coordinate | | (12) // path , path are X and y coordinates | | (13) of a branch or a destination | | (14) if path2≠ Null then | | (15) path = {path2, …, pathlength(path) − 1 | | (16) end if | | (17) Forward(path) | | (18) else if FirstTwoBits(path0) == 00 then | | (19) // the first byte in path is an ID | | (20) path = {path1, …, pathlength(path) − 1 | | (21) Forward(path) | | (22) end if | | (23) end if |
|