A sinkhole prevention mechanism for RPL in IoT